Question

Ryanm353 on Fri, 28 Nov 2014 19:19:02


Hi there,

Basically I have a form where a user logs in using a password at the minute. I have validation all entered on it, but im now wanting to put in a username field so that when the user puts in the value into the username textbox, when the other form opens it will say "Hello, (Name)!" 

The new textbox I have put in is TextBox2 on form4.vb, and the code for the login button is as follows;

"

  Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        If TextBox1.Text = "password" Then
            MsgBox("You are now logged in!", MsgBoxStyle.Information, "Login")
            Form1.Show()
        ElseIf TextBox1.Text = "" Then
            MsgBox("No password was entered. Please try again", MsgBoxStyle.Exclamation, "Error")
        ElseIf MsgBox("Wrong password. Please try again", MsgBoxStyle.Critical, "Fatal Error") Then
        End If
    End Sub"

All of that works fine, but what do I need to change to make it say hello (name) on for example form1.vb? I have a new textbox on form1.vb called TextBox6 which currently just says "Hello, " so i need to get the data from textbox2 on form4.vb to textbox6 on form1.vb if this makes sense.

Would anyone have any idea?

Many thanks,
Ryan.

Sponsored



Replies

davewilk on Sat, 29 Nov 2014 01:33:41


Hi there,

Basically I have a form where a user logs in using a password at the minute. I have validation all entered on it, but im now wanting to put in a username field so that when the user puts in the value into the username textbox, when the other form opens it will say "Hello, (Name)!" 

The new textbox I have put in is TextBox2 on form4.vb, and the code for the login button is as follows;

"

  Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        If TextBox1.Text = "password" Then
            MsgBox("You are now logged in!", MsgBoxStyle.Information, "Login")
            Form1.Show()
        ElseIf TextBox1.Text = "" Then
            MsgBox("No password was entered. Please try again", MsgBoxStyle.Exclamation, "Error")
        ElseIf MsgBox("Wrong password. Please try again", MsgBoxStyle.Critical, "Fatal Error") Then
        End If
    End Sub"

All of that works fine, but what do I need to change to make it say hello (name) on for example form1.vb? I have a new textbox on form1.vb called TextBox6 which currently just says "Hello, " so i need to get the data from textbox2 on form4.vb to textbox6 on form1.vb if this makes sense.

Would anyone have any idea?

Many thanks,
Ryan.

While this issue is common to all OOP languages, you would be better to ask VB.NET questions in a VB.NET forum, for example

https://social.msdn.microsoft.com/Forums/vstudio/en-US/home?forum=vbgeneral