Solved

Set Selected item in list box

Posted on 2006-10-26
5
384 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 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
how to send memory stream from ics Client To ics server ? 11 204
How to convert memory stream to PDF file 6 216
enhance the following code 3 50
DBCtrlGrid, Delphi, Scroll 7 34
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

738 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