Results 1 to 3 of 3

Thread: Merging ListBoxes

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Apr 2001
    Location
    Utah, USA
    Posts
    121

    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
    Josh -- Name
    Zevlag13 -- AIM

    www.WotsIt.org for all your file format spec questions!

  2. #2
    Hyperactive Member techman2553's Avatar
    Join Date
    Mar 2001
    Location
    <- To your left.
    Posts
    362
    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...
    ----------

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Apr 2001
    Location
    Utah, USA
    Posts
    121
    Thankyou, thats exactly what I needed...

    Zevlag
    Josh -- Name
    Zevlag13 -- AIM

    www.WotsIt.org for all your file format spec questions!

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