See if this helps.:)
Public Class Form1
Private arCmbItems() As String = {"item 1", "item 2", "item etc.", "item.Else"}
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
With ListBox1
.Items.AddRange(arCmbItems) '// add items to ListBox from String.Array.
End With
End Sub
Private Sub ListBox1_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
With ListBox2.Items
If Not ListBox1.SelectedIndex = -1 Then '// check if item is selected since Index.of -1 is No.Item.Selected.
.Clear() '// .Clear for new input.
Select Case ListBox1.SelectedItem '// check value selected.
Case arCmbItems(0) '// case 1st.item.
.Add("1a") : .Add("1b") : .Add("1c")
Case arCmbItems(2) '// case 3rd.item.
.Add("etc.a") : .Add("etc.b") : .Add("etc.c")
Case arCmbItems(1) '// case 2nd.item.
.Add("2a") : .Add("2b") : .Add("2c")
Case Else '// if any other item selected.
.Add("No items")
.Add("in String.Array")
.Add("for this .SelectedItem")
End Select
End If
End With
End Sub
End Class
codeorder
Posting Virtuoso
1,913 posts since Aug 2010
Reputation Points: 255
Solved Threads: 384
>>The code helped a lot
The "code" seems to help quite a bit more than a lot.
Glad I could help.:)
code.order
codeorder
Posting Virtuoso
1,913 posts since Aug 2010
Reputation Points: 255
Solved Threads: 384
april_004, start your own thread and send me a link via a p.m.; will see what I can do Then.
ng5, my.apologies for this post.
codeorder
Posting Virtuoso
1,913 posts since Aug 2010
Reputation Points: 255
Solved Threads: 384