AuthorMessage
Meka][Meka
Unstopable
Posts: 700

just a quick example of using Select Case instead of ElseIf, it can be better for longer if statements if u use select case instead
example of if >
Code:

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim str() As String = New String() {"test1", "5", "11", "whatever"}
        For i As Integer = 0 To 3
            Func(str(i))
        Next
    End Sub
    Private Sub Func(ByVal str As String)
        Try
            If str = "test1" Then ' a string
                str = "complete1"
            ElseIf CInt(str) = 5 Then ' a integer
                str = "complete2"
            ElseIf CInt(str) > 10 Then ' higher then
                str = "complete3"
            End If
        Catch ex As Exception
            str = "complete4"
        End Try
        MsgBox(str)
    End Function

not to to in Select case the exact same thing
Code:

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim str() As String = New String() {"test1", "5", "11", "whatever"}
        For i As Integer = 0 To 3
            Func(str(i))
        Next
    End Sub
    Private Sub Func(ByVal str As String)
        Select Case str
            Case "test1" : str = "complete1"
            Case Else 'for the cint
                Try
                    Select Case CInt(str)
                        Case Is = 5 : str = "complete2"
                        Case Is > 10 : str = "complete3"
                    End Select
                Catch ex As Exception
                    str = "complete4"
                End Try
        End Select
        MsgBox(str)
    End Function

njoy, ltr
-/Meka][Meka