Wrox Programmer Forums
|
Beginning VB 6 For coders who are new to Visual Basic, working in VB version 6 (not .NET).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 16th, 2006, 03:43 PM
Friend of Wrox
 
Join Date: Jun 2005
Posts: 244
Thanks: 3
Thanked 4 Times in 4 Posts
Default Strange VB

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!
__________________
Apocolypse2005, I'm a programmer - of sorts.
 
Old November 16th, 2006, 04:17 PM
Registered User
 
Join Date: Nov 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

 
Old December 3rd, 2006, 03:12 PM
Authorized User
 
Join Date: Dec 2006
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Because you use End If just before your bold line.
Pls Remove the Upper line and take relex.

 
Old December 4th, 2006, 02:48 PM
Friend of Wrox
 
Join Date: Jun 2005
Posts: 244
Thanks: 3
Thanked 4 Times in 4 Posts
Default

I see now, thanks :D





Similar Threads
Thread Thread Starter Forum Replies Last Post
strange IE problem sully7 BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 3 September 19th, 2008 08:44 AM
Strange Behaviour VeganMan BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 9 April 14th, 2008 11:16 AM
strange bug on IE Maxxim CSS Cascading Style Sheets 1 October 21st, 2007 10:06 PM
Really Strange... nooor83 BOOK: Professional Ajax ISBN: 978-0-471-77778-6 7 May 7th, 2006 12:51 PM
Strange error eraser Classic ASP Basics 3 September 21st, 2004 07:55 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.