From the April 2011 Issue of Prestwood eMag |
| Delphi Language Details: Records | |
|
Posted 21 years ago on 3/18/2003 and updated 12/12/2006
Take Away: Using record data types in Delphi.
KB100162
|
Using Records
Here is an example of using a record:
procedure TForm1.Button6Click(Sender: TObject);
{For convenience, declare a new type of record.}
type
TName = record
FName: String;
MInitial: String[1];
LName: String;
end;
var
recName: TName;
sFullName: String;
sSpace: String;
begin
with recName do begin
FName := 'Mike';
MInitial := 'A';
LName := 'Prestwood';
end;
sSpace := ' ';
sFullName := recName.FName +sSpace+ recName.MInitial +sSpace+ recName.LName;
ShowMessage(sFullName);
{Instead of using with…do, you can access a record directly. For example:}
ShowMessage(recName.LName);
end;
0 Comments.
Share a thought or comment...
KB Article #100162 Counter |
7853 |
Since 4/2/2008
|
|