?
Solved

Naming items in a radiobox to match items in Combobox ?

Posted on 2003-02-21
6
Medium Priority
?
184 Views
Last Modified: 2010-04-04
I have a combobox1 with 6 items in it.

'Mark'
'John'
'Mary'
'Luke'
'Jasmin'
'Jerry'

The following code adds one item to radiogroup1 for each item in combobox1.  However, the way I have written the code it adds the name in combobox1.itemindex 6 times instead of naming each item separate.  

I need to have each radiogroup item with the name in the combobox.  Can you help out with this ?

Here's what I have

procedure TForm1.Button1Click(Sender: TObject);
var
i : integer;
member : string;
begin

for i:= 0 to combobox1.items.count -1 do
begin
member := combobox1.items[combobox1.itemindex];
Radiogroup1.items.add(member);
end;
end;



Thanks in advance

Mark
0
Comment
Question by:Mark Brady
[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
  • 3
  • 3
6 Comments
 
LVL 20

Author Comment

by:Mark Brady
ID: 7997092
It's ok.  I have worked it out.  I changed the code to read this, and it works, thanks anyway...

procedure TForm1.Button1Click(Sender: TObject);
var
i, s : integer;
member : string;
begin

for i:= 0 to combobox1.items.count -1 do
begin
s := Combobox1.itemindex + 1;
combobox1.itemindex := ( s );
member := combobox1.items[combobox1.itemindex];
Radiogroup1.items.add(member);
inc ( s );
end;
end;
0
 
LVL 34

Accepted Solution

by:
Slick812 earned 150 total points
ID: 7997382
procedure TForm1.Button1Click(Sender: TObject);
var
i : integer;
begin

for i:= 0 to combobox1.items.count -1 do
  begin
  Radiogroup1.items.add(combobox1.items[i]);
  end;
end;
0
 
LVL 20

Author Comment

by:Mark Brady
ID: 8000350
Slick
Two things wrong with that code.
1:  As you can see, I've already posted the correct result above.
2:  Your code adds the correct amount of items to radiobox1 but doesn't add the names in the combobox.  What I proposed above works just fine.  Thanks anyway

Mark

p.s.  How do I close this question off now ???
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 34

Expert Comment

by:Slick812
ID: 8001595
ask to delete
0
 
LVL 34

Expert Comment

by:Slick812
ID: 8001665
and my code does add the text of the combobox items to the radio group
0
 
LVL 20

Author Comment

by:Mark Brady
ID: 8006640
I'm sorry, you are right it does. Just for me being wreong, you can have the points.  Thanks

Mark
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
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…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Suggested Courses

764 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