?
Solved

Set Selected item in list box

Posted on 2006-10-26
5
Medium Priority
?
393 Views
Last Modified: 2010-04-04
Hi all,

I'm having trouble figuring out how to set a selected item in a list box.  I have the text that I want to find, but the DoFindData is an inherited protected function.  I can also find the index of the row, but the SetItemIndex is also an inherited protected function so I am unable to use either one of these.  Any ideas on how I can choose what row is selected in the TListBox?

Thanks
0
Comment
Question by:Chipmunk77
[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
5 Comments
 
LVL 15

Assisted Solution

by:mikelittlewood
mikelittlewood earned 150 total points
ID: 17812339
ListBox.ItemIndex := Listbox.Items.IndexOf( 'This string')

Something like that?
0
 
LVL 14

Accepted Solution

by:
Pierre Cornelius earned 225 total points
ID: 17812342
Set the itemindex property

e.g. Listbox1.ItemIndex:= 1
0
 

Author Comment

by:Chipmunk77
ID: 17812471
Thanks all, that's what I get for trying to multitask!  Can't think straight!
0
 
LVL 17

Expert Comment

by:TheRealLoki
ID: 17814712
if you have "MultiSelect" set to tru though, you will need to set each item as selected manually
eg.
  listbox1.Selected[1] := true;
  listbox1.Selected[2] := true;
0
 
LVL 14

Expert Comment

by:Pierre Cornelius
ID: 17855637
Why a B grade?
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

764 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