Results 1 to 3 of 3

Thread: Quesion: Visible (True/False)....

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2003
    Location
    Bishop, GA
    Posts
    19

    Quesion: Visible (True/False)....

    In a List Box, I want to be able to show a certian number of names based on the selection from another List Box. Can I make it so only relevant info is displayed in the second List Box based on the original selection by using the Visible True False?

    In other words, you click in List Box 1 and based on your selection, determines what is displayed in List Box 2.

    Thanks,

    Joe

  2. #2
    PowerPoster
    Join Date
    Mar 2002
    Location
    UK
    Posts
    4,780
    Items in a listbox do not have visible properties, they are just objects (usually strings) so you cannot make them visible/invisible.

    You will have to add code under the change event for the first listbox and then add the data to the 2nd listbox depending on the options: e.g


    Code:
        Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
    
            MsgBox(CStr(ListBox1.SelectedItem) & " has been selected")
            'Add the avaiable options to the other box
            ListBox1.Items.Clear()
    
            If CStr(ListBox1.SelectedItem) = "Option1" Then
                ListBox2.Items.Add("New option1")
                ListBox2.Items.Add("New option2")
                ListBox2.Items.Add("New option3")
            Else
                ListBox2.Items.Add("Different option1")
                ListBox2.Items.Add("Different option2")
                ListBox2.Items.Add("Different option3")
            End If
    
        End Sub

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Mar 2003
    Location
    Bishop, GA
    Posts
    19
    Thanks a bunch I will try it now.

    Joe

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