Changing a File Name

I have a program that uses the following code...
[code]
procedure TForm1.FormCreate(Sender: TObject);
begin
AssignFile(AddrFile, 'VE3CRM.DAT');
if FileExists('VE3CRM.DAT') then
begin
Reset(AddrFile);
if (FileSize(AddrFile) > 0) then
begin
Seek(AddrFile, 0);
ReadRec;
NewRec := False;
end;
end
else
begin
Rewrite(AddrFile);
NewRec := True;
end;
btnNew.Enabled := True;
btnInsert.Enabled := False;
btnUpdate.Caption := '&Update';
end;
[/code]
How could I program this for the user to make his own file name
instead of VE3CRM.dat?
Thanks
Bob :-)
The only stupid question is the one not asked !!!

Comments

  • : I have a program that uses the following code...
    : [code]
    : procedure TForm1.FormCreate(Sender: TObject);
    : begin
    : AssignFile(AddrFile, 'VE3CRM.DAT');
    : if FileExists('VE3CRM.DAT') then
    : begin
    : Reset(AddrFile);
    : if (FileSize(AddrFile) > 0) then
    : begin
    : Seek(AddrFile, 0);
    : ReadRec;
    : NewRec := False;
    : end;
    : end
    : else
    : begin
    : Rewrite(AddrFile);
    : NewRec := True;
    : end;
    : btnNew.Enabled := True;
    : btnInsert.Enabled := False;
    : btnUpdate.Caption := '&Update';
    : end;
    : [/code]
    : How could I program this for the user to make his own file name
    : instead of VE3CRM.dat?
    : Thanks
    : Bob :-)
    : The only stupid question is the one not asked !!!
    :
    You need some kind of input-box for that, such as a TEdit. Then you need to change each occurrance of 'VE3CRM.dat' to the appropriate property (Edit1.Text for example).
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion