QUOTE(Metitron @ 4 Nov, 2009 - 08:48 AM)

the reason for this problem is that you only send into that if statment on the click event so if tb1 is empty when the button is clicked then it stops and is never sent back into the statement. looks like you may be able to do this with some kind of loop but it would be messy just easier to have it check each button click and if empty then that box gets focus.
But if the "if" statement is false it should jump to the next if statement. If the condition is true then a message box appears and then it will exit out of the sub, making the user enter an input in the field and click on the button again, going through the validation again. But you are right so I changed it to look at the first two If statements then added elseif after the first if statement for the focus function. Changed code, now it works.
CODE
If runnerTextBox1.Text = "" Or runnerTextBox2.Text = "" Or runnerTextBox3.Text = "" Then
MessageBox.Show("Please do not leave a field blank, please enter a name.", Application.ProductName, _
MessageBoxButtons.OK, MessageBoxIcon.Information)
If runnerTextBox1.Text = "" Then
runnerTextBox1.Focus()
ElseIf runnerTextBox2.Text = "" Then
runnerTextBox2.Focus()
ElseIf runnerTextBox3.Text = "" Then
runnerTextBox3.Focus()
End If
Exit Sub
End If
If timeTextBox1.Text = "" Or timeTextBox2.Text = "" Or timeTextBox3.Text = "" Then
MessageBox.Show("Please do not leave a field blank, please enter finishing time.", Application.ProductName, _
MessageBoxButtons.OK, MessageBoxIcon.Information)
If timeTextBox1.Text = String.Empty Then
timeTextBox1.Focus()
ElseIf timeTextBox2.Text = String.Empty Then
timeTextBox2.Focus()
ElseIf timeTextBox3.Text = String.Empty Then
timeTextBox3.Focus()
End If
Exit Sub
End If
And Mark, I did think about modularization, but this is still a little vague to me. I can do it in JAVA but VB.Net is still a learning process for me. Thanks all for helping me out.
This post has been edited by Boyet728: 4 Nov, 2009 - 09:56 AM