Results 1 to 4 of 4

Thread: [RESOLVED] Hel with listboxes needed

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Oct 2009
    Posts
    25

    Resolved [RESOLVED] Hel with listboxes needed

    People I have with me 2 listboxes(8 options) each having the same option at same index.
    I want to avoid the possibility of same option being selected from both lists.
    Its like team 1 vs team 2 so you probably get the idea right.
    There are 8 teams.
    I have no idea as to how to code this, so please help.

  2. #2
    Learning .Net danasegarane's Avatar
    Join Date
    Aug 2004
    Location
    VBForums
    Posts
    5,853

    Re: Hel with listboxes needed

    Hope this helps

    Code:
    Private Sub Command1_Click()
    If List1.ListIndex = List2.ListIndex Then
      'if both of them have the same selection
        MsgBox "selection not allowed"
    End If
    End Sub
    Please mark you thread resolved using the Thread Tools as shown

  3. #3
    Just a Member! seenu_1st's Avatar
    Join Date
    Aug 2007
    Location
    India
    Posts
    2,170

    Re: Hel with listboxes needed

    try something like this... with 2 listbox
    Code:
    Private Sub Form_Load()
    For i = 1 To 8
        List1.AddItem "Team " & i
        List2.AddItem "Team " & i
    Next
    End Sub
    
    Private Sub List1_Click()
    If List1.ListIndex = List2.ListIndex Then
        MsgBox "same team selected"
    End If
    End Sub
    
    Private Sub List2_Click()
    If List1.ListIndex = List2.ListIndex Then
        MsgBox "same team selected"
    End If
    End Sub
    hope u tried the samething with option button in another post is it? but there i cudnt get u, now i hope u got the idea for option button also...
    Last edited by seenu_1st; Oct 29th, 2009 at 02:58 AM.
    Seenu

    If this post is useful, pls don't forget to Rate this post.
    Pls mark thread as resolved once ur problem solved.
    ADO Tutorial Variable types SP6 for VB6, MsFlexGrid fast fill, Sorting Algorithms


  4. #4

    Thread Starter
    Junior Member
    Join Date
    Oct 2009
    Posts
    25

    Re: Hel with listboxes needed

    WORKS!!!!!!!!!!!!!!!!!!!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width