I'm trying to specify that multiple conditional statements need to be met before saving. If either of the statements are not met, then their respective error messages will pop up. The problem I'm having is I cannot get the error messages to show independantly. Am I on the right track or where do I go from here?

If the event number or person boxes are not blank and event assoc2 box is not equal to stolen then
         'call save
else if event number or person are blank
            ' error message
or if event assoc2 is equal to stolen and original value is blank then
                ' error message



 If Not (EVENT_NUMBER.Text = "" Or person.Text = "") And EVENT_ASSOC2.Text <> "Stolen" Then

                        'Call CREATE_EXCEL_FILE(outputdirectory) to save
                        Else

                        End If

                    Elseif  EVENT_ASSOC2.Text = "Stolen" And ORIGINAL_VALUE.Text = "" Then
                        MessageBox.Show("Property listed as stolen requires a value", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Error)
                    Else

                        MessageBox.Show("Person and Event Number fields need to be completed", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Stop)

                    End If

How are you verifying the data in the textboxes? Your code should work. If EVENT_ASSOC2.Text = "Stolen" And ORIGINAL_VALUE.Text = "" then you should get the first error message. The second error message will only show if EVENT_NUMBER.Text = "" Or person.Text = "" and the first error message doesn't show

I think you want this:

IF not(EVENT_NUMBER.Text ="" Or person.Text ="") And Event_ASSOC2.Text <> "Stolen" then
    'Call your create excel file
ElseIf Event_ASSOC.Text ="Stolen" And ORIGINAL_VALUE.Text =""  then
    messagebox.show("Property listed as stolen requires a value", "Warning", Messageboxbuttons.ok, MessageBoxIcon.Error)
ElseIF EVENT_NUMBER.Text ="" Or person.Text ="" then
    messagebox.show ("Person and Event Number Fields ned to be completed", "Error!", Messageboxbuttons.ok, MessageBoxIcon.Stop)
Else
    'if Event_Number and Person are filled in and Event_Assoc2.text ="Stolen" but Orignal_Value.Text <>""
    'You'd end up here...
End if

I don't see the benefit in going to a case block. You'd still end up with nested ifs:

SELECT CASE Event_Assoc.text
    Case "Stolen"
        if ORIGINAL_VALUE.Text ="" Then
            'Messagebox
        Else
            'do what?
        End if
    Case Else
        if EVENT_NUMBER.Text ="" OR person.Text ="" then
            'messagebox
        else
            'call your Excel file
        end if
End Select

So why not just use a big If block?

If Event_Assoc.Text ="Stolen" Then
    IF ORIGINAL_VALUE.Text ="" then
        'messagebox
    End if
ELSE
    if EVENT_NUMBER.Text ="" OR person.Text ="" then
            'messagebox
    else
           'call your Excel file
    end if    
End if

I find a convenient way to handle complex logic is to use this form of the Select

Select Case True
    Case <conditional>
        code
    Case <conditional>
        code
    Case <conditional>
        code
    Case Else
        code
End Select

Normally in a Select you would put the conditional in the Select clause. With Select Case True you can put any conditional in the Case clauses. They don't have to be related. Just put them in the order you would code them with Else If statements. Also, if you want to remove parentheses in compound conditionals then

Not (a Or B)

is equivalent to

Not a And Not B

or to use the above example

not(EVENT_NUMBER.Text ="" Or person.Text ="") And Event_ASSOC2.Text <> "Stolen"

is equivalent to

EVENT_NUMBER.Text <> "" And person.Text <> "" And Event_ASSOC2.Text <> "Stolen"
commented: interesting use of Select +0

Thanks Jim,
this is a true life saver!
"Select Case True", noboby tells you these things!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.