Solved

How to programatically select an item in a multi-exteded listbox

Posted on 2006-06-27
4
202 Views
Last Modified: 2010-04-23
My listbox is fully populated, and based upon certain program conditions, I want to select certain (multiple) items programatically.

I would expect something like this to work:
     LB_Clients.Items(i).selected = True
but it simply gives me an error message


Thanks in advance for your help.

Extra points due to urgency
0
Comment
Question by:bobdowdy
  • 2
4 Comments
 
LVL 48

Assisted Solution

by:AlexFM
AlexFM earned 250 total points
ID: 16992565
Use ListBox.SetSelected Method to select/unselect items in multiple-selection ListBox.

http://msdn2.microsoft.com/en-us/library/system.windows.forms.listbox.setselected.aspx
0
 
LVL 7

Expert Comment

by:pradeepsudharsan
ID: 16992590
ListBox1.SelectedIndex = 1
i.e

ListBox1.SelectedIndex = i
0
 
LVL 7

Accepted Solution

by:
pradeepsudharsan earned 250 total points
ID: 16992621
 'Syntax: ListBox1.SetSelected(index,boolean value)
       
        ListBox1.SetSelected(1, True) 'To select the item
        ListBox1.SetSelected(1, False) 'To unselect the item
0
 

Author Comment

by:bobdowdy
ID: 16992815
Thanks a million - I split points because while alex was first, pradeep provided answer instead of reference. Thanks again.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now