Solved

Set Selected item in list box

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
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…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

708 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

13 Experts available now in Live!

Get 1:1 Help Now