I want to show the firstname and familyname in a textbox in the main form.
I've got a registrationform with a firstname, familyname, username and password
After registration it is registrated in a tableregistration.
It's working fine to show the username into a textbox in the main form (see code)
How can I show the firstname and familyname in the textbox instead of the username
Thanks in advance.Code:Private Sub Btn_login_Click(sender As Object, e As EventArgs) Handles Btn_login.Click Dim cmd As New SqlCommand("select * from tableregistration where username = @username and password = @password ", con) con.Open() cmd.Parameters.Add("@username", SqlDbType.VarChar).Value = txtusername.Text cmd.Parameters.Add("@password", SqlDbType.VarChar).Value = txtpassword.Text Dim adapt As New SqlDataAdapter(cmd) Dim table As New DataTable adapt.Fill(table) con.Close() If table.Rows.Count() <= 0 Then MessageBox.Show("Username or password invalid or not yet registered !") txtusername.Text = "" txtpassword.Text = "" txtusername.Focus() Else ' It shows the username perfectly ! MessageBox.Show("Welcome" & " " & txtusername.Text) Frm_main.TextBox1.Text = txtusername.Text Me.Close() End If End Sub





Reply With Quote