CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 1999
    Location
    Blue Springs, MO
    Posts
    43

    Select item in listbox via code

    How do you select an item in a listbox using code?

    I have an app that adds items to the listbox and I need to select that item.

    Thanks!


  2. #2
    Join Date
    Aug 2000
    Location
    Namibia
    Posts
    139

    Re: Select item in listbox via code

    The easiest way to do this is to set the listview's text property to the item you want selected.


  3. #3
    Join Date
    Aug 1999
    Location
    Blue Springs, MO
    Posts
    43

    Re: Select item in listbox via code

    I'll give that a try, thank you!


  4. #4
    Join Date
    Apr 2000
    Location
    South Carolina,USA
    Posts
    2,210

    Re: Select item in listbox via code


    ListView1.ListItems(5).Selected = true
    ListView1.SetFocus



    (5) is the row to be selected. YOu cold also use a KEY if present

    John G

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

Featured