Results 1 to 5 of 5

Thread: Newbie Question [RESOLVED]

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 2004
    Location
    Philippines
    Posts
    149

    Resolved Newbie Question [RESOLVED]

    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
    VB Code:
    1. List2.ListIndex = List1.ListIndex
    but it does not work ..... thanks in advance
    Last edited by Zelot; Aug 24th, 2005 at 11:44 PM. Reason: RESOLVED

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Newbie Question

    You mean like this for VB6?
    VB Code:
    1. Option Explicit
    2.  
    3. Private Sub Form_Load()
    4.     List1.AddItem "Test1"
    5.     List1.AddItem "Test2"
    6.     List1.AddItem "Test3"
    7.     List2.AddItem "Test1"
    8.     List2.AddItem "Test2"
    9.     List2.AddItem "Test3"
    10. End Sub
    11.  
    12. Private Sub List1_Click()
    13.     List2.ListIndex = List1.ListIndex
    14. End Sub
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Oct 2004
    Location
    Philippines
    Posts
    149

    Re: Newbie Question

    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

  4. #4
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Newbie Question

    Oh, ok then...
    VB Code:
    1. Option Explicit
    2.  
    3. Private Sub Form_Load()
    4.     List1.AddItem "Test1"
    5.     List1.AddItem "Test2"
    6.     List1.AddItem "Test3"
    7. End Sub
    8.  
    9. Private Sub List1_Click()
    10.     List2.AddItem List1.List(List1.ListIndex)
    11. End Sub
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Oct 2004
    Location
    Philippines
    Posts
    149

    Re: Newbie Question

    It worked thanks

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