-
Merging ListBoxes
OK I have two list boxes which are populated and each have the same amount of entries.
What I need to konw is how to either detect which index is selected (on both sides) and merge the data copy it to the clipboard. I am using this code to keep the slected Index's the same:
Code:
Private Sub List1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
List2.ListIndex = List1.ListIndex
End Sub
Private Sub List2_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
List1.ListIndex = List2.ListIndex
End Sub
or use arrays somehow and merge the data then copy it to the clipboard.. On row at a time with a msgbox in between...
figured this out to do one side but not the other
Code:
Dim strArray1() As String
For X = 0 To List1.ListCount - 1
ReDim Preserve strArray1(X)
strArray1 = List1.List(X)
Next
For Each Var In strArray1
Clipboard.Clear
Clipboard.SetText Var
MsgBox "Please paste that info now before you click OK"
Next
Zevlag
-
I'm not sure what you are trying to do, but this line of code will copy the selected entry in List1 and the selected entry in List2.
If List1 had "First" highlighted and List2 had "Name" highlighted, then the clipboard will contain "First Name".
Code:
Clipboard.Set TextList1.List(List1.ListIndex) & " " & List2.List(List2.ListIndex)
If you need more help, let me know...
-
Thankyou, thats exactly what I needed...
Zevlag