Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Set Selected item in list box

Posted on 2006-10-26
5
Medium Priority
?
406 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
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…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

636 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