Solved

ListBox Question For The Experts

Posted on 1998-12-07
10
168 Views
Last Modified: 2010-04-04
I have tvo listbox when i click any item in the listbox1 then i will the listbox2 item moves to the itemindex of listbox1 ( the blue arround it )and one question ( what is the "values" and "Name" properties of this component? how can i use them..Thanks.....
0
Comment
Question by:emiltor
[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
10 Comments
 
LVL 12

Accepted Solution

by:
rwilson032697 earned 50 total points
ID: 1349758
The name property is the componet name (eg: ListBox1). There is not property "values" in the TlistBox component, I assume you mean "items".

Items is the list of entries in the list box. To add some items you can do this:

listBox1.items.add('Item 1');
listBox1.items.add('Item 2');
listBox1.items.add('Item 3');

Cheers,

Raymond.
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 1349759
hi emiltor,

first:

procedure TForm1.ListBox1Click(Sender: TObject);
begin
  Listbox2.ItemIndex := listbox1.ItemIndex;
end;

second

  There is no value property
  Name is the property where you can name the component

meikl

0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 1349760
hi emiltor,

the items in listbox contains the property values

you can use this, when the entries in the listbox in the following format

xy=z

with

with listbox1.items.values['xy'] you can retrieve the z

sample

  edit1.text :=  listbox1.items.values['xy'];

meikl
0
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!

 
LVL 10

Expert Comment

by:viktornet
ID: 1349761
YOu can use this..

OnClick()

ListBox2.ItemIndex := ListBox1.ItemIndex;

or if the same string is in a different line then you can use something like this...

ListBox2.ItemIndex := ListBox2.IndexOf(ListBox1.Items.Strings[ListBox1.ItemIndex]);

Hope this helps...

Cheers,
Viktor
0
 

Author Comment

by:emiltor
ID: 1349762
Adjusted points to 50
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 1349763
hi emiltor,

are you sure that your accepted answer reflects your question?

meikl
0
 

Author Comment

by:emiltor
ID: 1349764
Yes..... Victornet have it
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 1349765
Oh .. really?

i think rwilson have it

meikl
0
 

Author Comment

by:emiltor
ID: 1349766
RWilson have the answer for "Values" question And Name but not the other question

Like move the blue arround the text in listbox2 on listbox1.itemindex
Viktornet have the answer for that...


0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 1349767
as you mean
its your thread

meikl

0

Featured Post

Industry Leaders: 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

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…
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…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

724 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