Question code for update button?


New member
May 27, 2010
Programming Experience
i have one registration form which consists of username, password, confirmpassword and Register button.
When i will be typing the username, it should show whether the username is available or not. and i have changed the username column as primary key in sql database.

Private Sub txtusername1_KeyUp(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtusername1.KeyUp
Dim da As New SqlDataAdapter("select * from Register", con)
da.Fill(ds, "Register1")
If txtusername1.Text = ds.Tables("Register1").Rows(0)(0).ToString Then
lblusernameerror.Text = "Username is not available,choose another"
lblusernameerror.Text = "Username is available"
End If
End Sub

here i have written key up event in the text box of username, but here it is loading only one username...
please give the correct coding and help me

and also coding for primary key exception using exceptional handling.

so i need the coding for that requirement...

and also how to clear the text from the form...

I am using visual basic 2008 and i am writing the program in disconected architecture in
thanks in advance..
please help me soon
Last edited by a moderator:
Top Bottom