 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Guest
|
Posted: Fri Jan 26, 2007 9:11 am Post subject: How to save a value from a list box into a record |
|
|
I'm new to Delphi and am having a few problems with saving an item from
a list box on my form into a record.
What data type do I need to set up my record as and how do I implement
assigning the value selected by the user from my list box into my
record?
Here is the declaration of my record (CustomerCar is the field I want
to save the list box data to):
Booking=Record
CustomerCar:String[100];
Date:String[8];
Time:String[5];
MOT:Boolean;
Service:Boolean;
Comments:String[255];
end;
....
procedure TFormAddBooking.btnOkClick(Sender: TObject);
begin
with BookingRecord do
begin
CustomerCar:=LstCustCar //What goes here?//
...
Date:=TxtDate.Text;
end;
end; |
|
| Back to top |
|
 |
leehanken Guest
|
Posted: Sat Jan 27, 2007 4:40 am Post subject: Re: How to save a value from a list box into a record |
|
|
hope this helps:
procedure TFormAddBooking.btnOkClick(Sender: TObject);
var
index : Integer;
begin
index := LstCustCar.ItemIndex;
with BookingRecord do
begin
CustomerCar:=LstCustCar.Items[index];
....
On 26 Jan, 09:07, timn...@gmail.com wrote:
| Quote: | I'm new to Delphi and am having a few problems with saving an item from
a list box on my form into a record.
What data type do I need to set up my record as and how do I implement
assigning the value selected by the user from my list box into my
record?
Here is the declaration of my record (CustomerCar is the field I want
to save the list box data to):
Booking=Record
CustomerCar:String[100];
Date:String[8];
Time:String[5];
MOT:Boolean;
Service:Boolean;
Comments:String[255];
end;
...
procedure TFormAddBooking.btnOkClick(Sender: TObject);
begin
with BookingRecord do
begin
CustomerCar:=LstCustCar //What goes here?//
...
Date:=TxtDate.Text;
end;
end; |
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|