audio_uphoria
Active member
- Joined
- Jan 28, 2009
- Messages
- 31
- Programming Experience
- Beginner
Hi, I'm programming something and I have it set to where if you leave the text box blank then a message box comes up and tells you to enter a value to move on to the next text box
I also have the exit button programmed as follows
Now whats currently happening is if I click the exit button and leave the name text box blank the error i programmed will come up and tell me to enter a name. I want to be able to click the exit button while no text is entered in the name text box bypassing the error message. How would I do that? Thanks!
VB.NET:
Private Sub txtName_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtName.Leave
If IsNumeric(txtName.Text) Then
MessageBox.Show("Please enter only your first and last name", "Error")
txtName.Focus()
ElseIf txtName.Text = "" Then
MessageBox.Show("Please enter your name in name field", "Error")
txtName.Focus()
elseif
End If
End Sub
I also have the exit button programmed as follows
VB.NET:
Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
' When clicking the exit button, message box will ask user to confirm exit
If MessageBox.Show("Would you like to end this program?", "End Program?", MessageBoxButtons.OKCancel, _
MessageBoxIcon.Question) = Windows.Forms.DialogResult.OK Then
Me.Close()
End If
End Sub
Now whats currently happening is if I click the exit button and leave the name text box blank the error i programmed will come up and tell me to enter a name. I want to be able to click the exit button while no text is entered in the name text box bypassing the error message. How would I do that? Thanks!