|
-
Mar 7th, 2003, 10:44 AM
#1
Thread Starter
Junior Member
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
-
Mar 7th, 2003, 11:36 AM
#2
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
-
Mar 7th, 2003, 11:38 AM
#3
Thread Starter
Junior Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|