Hi all
I run into a problem and I'm asking for you help again.
I have a IF statement which is checking each row in the data table (for a match) and ELSE statement with commands which are executed if the If statement is not satisfied.
Now I would like to write like so that it goes to the Else part BUT ONLY for values which are not satisfied in the IF statement. If I am more specific; I would like to calculate values if a match is found and just print them if it is not fond (usually there are both cases). Now the problem is the text that is marked red; if there is a match found I don't want it processed BUT if the match is found I do. How can I write that??

currencyPosition = 0
        Dim d As Integer = w + 100
        For Each currency In Ary
            If Not currency = "" Then
                For i = 0 To dt.Rows.Count - 1

                    If currency = dt.Rows(i).Item(5).ToString.Replace(" ", "") Then
                        If CDbl(dt.Rows(i).Item(4)) < CDbl(AryCurrencyValue(currencyPosition)) Then
                            e.Graphics.DrawString(("Z A  I Z P L A Č I L O   1 :" & " " & CDbl(AryCurrencyValue(currencyPosition)) - CDbl(dt.Rows(i).Item(4)) & "  " & currency), fnt, Brushes.Black, 200, d + 25)
                            currencyPosition = currencyPosition + 1
                            Exit For
                        ElseIf CDbl(dt.Rows(i).Item(4)) > CDbl(AryCurrencyValue(currencyPosition)) Then
                            e.Graphics.DrawString(("Z A  V R A Č I L O  11:" & "     " & CDbl(dt.Rows(i).Item(4)) - CDbl(AryCurrencyValue(currencyPosition)) & "  " & currency), fnt, Brushes.Black, 200, d + 25)
                            currencyPosition = currencyPosition + 1
                            Exit For
                        End If

                    Else
                        e.Graphics.DrawString(("Z A  I Z P L A Č I L O  111:" & " " & CDbl(AryCurrencyValue(currencyPosition)) & "  " & currency), fnt, Brushes.Black, 200, d + 50)

                        currencyPosition = currencyPosition + 1 
                        d = d + 25

                        If Not dt.Rows(i).Item(4) = Nothing Then

                            e.Graphics.DrawString("Z A  V R A Č I L O  1111:" & "     " & dt.Rows(i).Item(4) & "   " & dt.Rows(i).Item(5), fnt, Brushes.Black, 200, d + 200)
                            Exit For
                        End If
                        Exit For
                    End If
                Next
            End If
        Next

You can use something like the following:

if condition1 or condition2 or condition3 or condition4 Then


Else

End If
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.