shows how to select items in a ListBox in code

Started by nandagopal, May 21, 2009, 12:40 AM

previous topic - next topic
Go Down

nandagopal

For a ListBox that allows single selection, either set the SelectedIndex or the SelectedItem property.

For a ListBox that allows multiple selection, use the SetSelected method to selected or deselect items.

Code: [Select]

' Select item 4 in ListBox1.
' (Alternatively set ListBox1.SelectedItem.)
ListBox1.SelectedIndex = 4
'Or do this: ListBox1.SelectedItem = ListBox1.Items(4)

' Select every third item in ListBox2.
For i As Integer = 1 To ListBox2.Items.Count - 1 Step 3
    ListBox2.SetSelected(i, True)
Next i



dhoni

this code is very useful to me for select item in listbox code
it can easily use in vb.net code

Go Up
 

Quick Reply

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Note: this post will not display until it's been approved by a moderator.
Name:
Email:
Verification:
Please leave this box empty:

Type the letters shown in the picture
Listen to the letters / Request another image

Type the letters shown in the picture:

shortcuts: alt+s submit/post or alt+p preview
IT Acumens Web Design Chennai | GinGly :: Mobile SMS Backup | CineBuzz :: Latest Cinema News | My Kids Diary :: Kids magical moment :: Book domain name @ 99 Rs monthly
Copyright 2005 - 2019 :: IT Acumens :: All Rights Reserved.
ITAcumens Forum with 2 lakhs post running for 14 years - Powered by IT Acumens Dedicated Server