I have two listbox, List1 and List2. What I wanted to do is to display in list2 the text that I selected in list1. I tried some codes like
but it does not work ..... thanks in advance :DVB Code:
List2.ListIndex = List1.ListIndex
Printable View
I have two listbox, List1 and List2. What I wanted to do is to display in list2 the text that I selected in list1. I tried some codes like
but it does not work ..... thanks in advance :DVB Code:
List2.ListIndex = List1.ListIndex
You mean like this for VB6?
VB Code:
Option Explicit Private Sub Form_Load() List1.AddItem "Test1" List1.AddItem "Test2" List1.AddItem "Test3" List2.AddItem "Test1" List2.AddItem "Test2" List2.AddItem "Test3" End Sub Private Sub List1_Click() List2.ListIndex = List1.ListIndex End Sub
List1 would contain all of the list while list2 won't have anything on it. What I wanted to do is when I click on an Item in List1 that Item would show on List2
Oh, ok then...
VB Code:
Option Explicit Private Sub Form_Load() List1.AddItem "Test1" List1.AddItem "Test2" List1.AddItem "Test3" End Sub Private Sub List1_Click() List2.AddItem List1.List(List1.ListIndex) End Sub
It worked thanks :bigyello: :thumb: