Solved

Set Selected item in list box

Posted on 2006-10-26
5
372 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
5 Comments
 
LVL 15

Assisted Solution

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

Something like that?
0
 
LVL 14

Accepted Solution

by:
Pierre Cornelius earned 75 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

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
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…
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

863 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

20 Experts available now in Live!

Get 1:1 Help Now