Hi!
Everyone I am doing one business project in VB.NET... that every form and controls validation are very important, please help me....I am beginner of the VB.NET, suppose to run the form, after finishing data entry to click EXIT button, to show the msgbox if 'yes' close the form, 'no' form never closed...like how i check SAVE,DELETE,EDIT after i am going to click these buttons check the mandatory field.... please help me...VERY URGENT

My advance thanks
Saravanarajan

i am not sure if i understand you .
any way to check mandatory fields , check they not empty
for example if user must enter ID in textbox check it like this

if Id_textbox="" then 
Label1.Text = "you must enter the ID"
end if

about confirming exit the form use msgbox like this

Dim c As Integer
c = MsgBox("are you sure you want to exit", MsgBoxStyle.OKCancel, "Exit")
        If c = 1 Then
            Me.Close()
        End If

its only working exit button query.....plz understand my problem but if click save button at the time to check all the mandatory field and also to show all the field in list to user with msg, "you must enter these fields.....plese help me

regds,
saravanarajan

Hi u can do like this

If Me.Txt_Width.Text = "" Then
MessageBox.Show("Please Enter Width Information")
Me.Txt_Width.Focus()

ElseIf Me.Txt_Width.Text.Length > 5 Then
MessageBox.Show("Please Enter Length Less Than 5")
Me.Txt_Width.Focus()

ElseIf Not Me.regex_Num.IsMatch(Me.Txt_Width.Text) Then
MessageBox.Show("Please Enter Only Digits")
Me.Txt_Width.Focus()

ElseIf Me.Txt_Length.Text = "" Then
MessageBox.Show("Please Enter Length Information")
Me.Txt_Length.Focus()

ElseIf Me.Txt_Length.Text.Length > 5 Then
MessageBox.Show("Please Enter Length Less Than 5")
Me.Txt_Width.Focus()

ElseIf Not Me.regex_Num.IsMatch(Me.Txt_Width.Text) Then
MessageBox.Show("Please Enter Only Digits")
Me.Txt_Length.Focus()

ElseIf Me.Txt_Nearest_Location.Text = "" Then
MessageBox.Show("Please Enter Nearest Location Information")
Me.Txt_Nearest_Location.Focus()

ElseIf Me.Txt_Nearest_Location.Text.Length > 100 Then
MessageBox.Show("Please Enter Length Less Than 100")
Me.Txt_Nearest_Location.Focus()

ElseIf Me.Txt_Code.Text = "" Then
MessageBox.Show("Please Enter Board Code Information")
Me.Txt_Code.Focus()

ElseIf Me.Txt_Map_Reference.Text = """" Then
MessageBox.Show("Please Enter Board Map Reference Information")
Me.Txt_Code.Focus()

ElseIf Not regex_Num.IsMatch(Me.Txt_Code.Text) Then
MessageBox.Show("Please Enter Number In Correct Format")
Me.Txt_Code.Focus()

ElseIf Me.Txt_Map_Reference.Text = "" Then
MessageBox.Show("Please Enter Map Reference information")
Me.Txt_Map_Reference.Focus()

This article has been dead for over six months. Start a new discussion instead.