Hi,
This code will work:
procedure TForm1.Button5Click(Sender: TObject);
begin
If OpenDialog1.Execute then Edit1.Text:=OpenDialog1.Filename;
end;
FreeAndRelease should not be used - it's for internal use only.
You need to check the returned Boolean value, as the user may not have
selected a file, but cancelled.
Regards,
Brendan.
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Steve Bowker
Sent: 19 September 2008 15:32
To: delphi elists
Subject: OpenDialog1.Filename display problem
Hi,
It's always the way, you try and do something simple, and run into a
brick wall!
OK, I have a button I click to open up a dialog:
procedure TForm1.Button15Click(Sender: TObject);
begin
OpenDialog1.Execute;
OpenDialog1.FreeOnRelease;
end;
When I click the button, the dialog pops up, I select a file, and just
want to display it in an Edit field as follows:
procedure TForm1.OpenDialog1Close(Sender: TObject);
begin
Edit13.Text := Opendialog1.Filename;
end;
But what is displayed in the Edit field is rubbish such as "às" or
"@t" - which is strange because the contents differ even if I select
the same file each time!
I think this might be something to do with Unicode characters(?) but am
not sure.
I am using Delphi 5 on Windows XP SP2
Any help appreciated.
Regards,
Steve Bowker
_______________________________________________
Delphi mailing list -> [email protected]
http://lists.elists.org/cgi-bin/mailman/listinfo/delphi
_______________________________________________
Delphi mailing list -> [email protected]
http://lists.elists.org/cgi-bin/mailman/listinfo/delphi