Subject: Strange VB
Posted By: Apocolypse2005 Post Date: 11/16/2006 2:43:21 PM
This is so strange
"Can't have else without if" in the code between the bold

Private Sub cmdRemove_Click()
Dim i As Integer

If Check1.Value = 1 And Check2.Value = 0 Then
        For i = lstLeft.ListCount - 1 To 0 Step -1
            ' Delete this item.
            If lstLeft.Selected(i) Then
                lstLeft.RemoveItem i
            End If
        Next i
    ElseIf Check2.Value = 1 And Check1.Value = 0 Then
        
            For i = lstRight.ListCount - 1 To 0 Step -1
                ' Remove this item.
                If lstRight.Selected(i) Then
                    lstRight.RemoveItem i
                End If
            Next i
        End If
    ElseIf Check2.Value = 0 And Check1.Value = 0 Or Check2.Value = 1
        And Check1.Value = 1 Then
        cmdRemove.Enabled = True
    End If
End Sub

How wierd
Can anyone help?



------------------------------------------------
Apocolypse2005
Always ready and waiting to help!
Reply By: bomber Reply Date: 11/16/2006 3:17:31 PM
It seems to me that just above the bold line you have one too many End If. try removing that one and see if it works

Reply By: Dharam Pal Sikhwal Reply Date: 12/3/2006 2:12:28 PM
Because you use End If just before your bold line.
Pls Remove the Upper line and take relex.

Reply By: Apocolypse2005 Reply Date: 12/4/2006 1:48:01 PM
I see now, thanks :D

Go to topic 52873

Return to index page 103
Return to index page 102
Return to index page 101
Return to index page 100
Return to index page 99
Return to index page 98
Return to index page 97
Return to index page 96
Return to index page 95
Return to index page 94