write one function frmValidate() return type as boolean call this function in your button click code in If condition. In this function you have to check the entered value in the textbox is valid or not. code are as given below.
// write this after button click
if FrmValidate() Then
// show ur next e.g frmMDI.show()
End if
/*This is your function to check the entered value in the textbox is valid or not if not then it will display messagbox.*/
Private Function FrmValidate() As Boolean
Dim str, UserName,Password As String
UserName=ds.Tables("login_master").Rows(0).Item("username")
Password= ds.Tables(("login_master").Rows(0).Item("password")
if Not TextBox1.text = UserName.Trim Or Not
TextBox2.text = Password.Trim Then
str = "Invalid Password or Username.....Try Again."
MsgBox(str,MsgBoxStyle.Information+vbOKOnly, "Incorrect password or username")
TextBox1.Clear()
TextBox2.Clear()
Return False
End If
Return True
End Function
Hope this will help you .
Thanks & Regards
Farukh