Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i am working oo the login screen vb.net and i have to make validation on it

i just make if the textbox empty an error message will appear

i want more than this one
any one have??
Posted

Here is the sample code:

VB
If String.IsNullorWhitespace(txtBoxName.text) Then
     MsgBox("Error")
     End Sub
End If
 
Share this answer
 
Comments
dr.dream 1-Mar-12 11:06am    
it is not working
dr.dream 1-Mar-12 11:07am    
i am using this code:
Try


If txtname.Text = "" Or txtpass.Text = "" Then


MessageBox.Show("Invalid Username or Password")


Exit Sub


End If


Catch ex As Exception


MessageBox.Show(ex.Message)


Me.Hide()


End Try


home.Show()
dr.dream 1-Mar-12 11:07am    
so where is should put it?
Isuru Nanayakkara 1-Mar-12 13:07pm    
in the next step of your program's flow perhaps? I assume it would be a button for login. Put this code in the button's click event. Btw @GanesanSenthilvel's answer is good for validating Textboxes.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900