Solved

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

Posted on 2006-06-27
4
208 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Create a Dropdown list with sub group 10 43
vb.net background worker crossthread 11 43
reading an excel file vb.net 2 46
wrapping text in datagridview header columns 1 29
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
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…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

734 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