Hello, firstly I am a complete novice. I am trying to trying to write code that will detect if a text box, txtMaxLength65 or txtMaxLength35, has an entry after a value is entered into text box, txtSpace. If not then a message box is displayed. The problem is that after the message box is clicked the code goes back to the start of the sub. It again runs through the sub to End Sub but returns to txtMaxLth35 (or txtMax65), and then ends correctly with the correct text box selected. Why doesn't it just run through without back tracking.
Thanks
Peter
Thanks
Peter
Code:
Private Sub txtPanelsQty1_TextChanged_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtSpace.Leave
If txtMaxLength65.Text = String.Empty And rbtSlatSize65.Checked = True Then
MessageBox.Show("Message")
txtMaxLength65.Select()
Exit Sub
End If
If txtMaxLength35.Text = String.Empty And rbtSlatSize35.Checked = True Then
MessageBox.Show("Message")
txtMaxLength35.Select()
Exit Sub
End If
End Sub