if statements

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • lillyehrhart
    New Member
    • Jun 2015
    • 48

    if statements

    I have created and if statement to check and see if the the text boxes and combo boxes are null. it throws the error if they are null. when i click ok, the goal is to make it go back to the form to fill out what was missing. in my case, it does not, it just continues to my next form with no data. When you click ok on the message box, how do you make it not continue with the code and just default back to the original form to enter the information that is missing?

    Code:
    If (svcCombobox.Text.Equals("")) Then
                MessageBox.Show("Select a service method")
            ElseIf (destZipTextbox.Text.Equals("")) Then
                MessageBox.Show("Enter a destination zip code")
            ElseIf (originZipTxtbox.Text.Equals("")) Then
                MessageBox.Show("Enter an origin zip code")
            ElseIf (oCCCombobox.Text.Equals("")) Then
                MessageBox.Show("Select an origin country code")
            ElseIf (DCCcOMBOBOX.Text.Equals("")) Then
                MessageBox.Show("Select a destination country code")
    
            End If
  • laurajchambers
    New Member
    • Aug 2014
    • 17

    #2
    Do you need to add
    Code:
    Exit Sub
    after each of the
    Code:
    MessageBox
    lines?

    Comment

    Working...