Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > General > how to make item in listbox selected


Reply
 
Thread Tools Display Modes
  #1  
Old 11-16-2003, 04:52 PM
kalin kalin is offline
Newcomer
 
Join Date: Oct 2003
Posts: 12
Default how to make item in listbox selected


i was wondering if anyone could tell me how to make a listbox item (at whichever index) selected...like say my list is

apples
oranges
banannas
pears

how do i make the oranges text in the listbox show up selected?
Reply With Quote
  #2  
Old 11-16-2003, 05:01 PM
mrjeffy321 mrjeffy321 is offline
Ultimate Contributor
 
Join Date: Apr 2003
Location: Texas, USA
Posts: 1,623
Default

Code:
List1.Selected(1) = True
would make the item at element 1 be selected
Reply With Quote
  #3  
Old 11-16-2003, 05:25 PM
Iceplug's Avatar
Iceplug Iceplug is offline
MetaCenturion

Retired Moderator
* Guru *
 
Join Date: Aug 2001
Location: California, USA
Posts: 16,583
Default

The above works if the listbox is supporting multiple selections.
Otherwise, List1.ListIndex = 1
is the classical way.
__________________

Iceplug, USN
Quadrill 1 Quadrill 2 (full) Quadrill 3 JumpCross .NET Website is ALIVE! - DL Platform Tour for VB.NET! Posting Guidelines Hint: Specify your location in your user cp profile if you want compassion!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Removing listbox selected item knight General 30 11-09-2003 09:26 PM
How to show the selected item in a listview? Coen Interface and Graphics 1 09-26-2003 06:22 AM
Selected item in a listbox Rookie General 4 09-06-2003 09:30 AM
VB Menus John General 8 02-05-2002 09:31 AM

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->