Solved

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

Posted on 2006-06-27
4
203 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
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…

911 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

21 Experts available now in Live!

Get 1:1 Help Now