Link to home
Start Free TrialLog in
Avatar of sergio_2001
sergio_2001

asked on

OpenDialog.Filename problem

When I try to get one file name using OpenDialog.filename it returns some garbage...
Example:  ShowMessage('File name is '+ OpenDialog1.filename);

It returns something like this:   File name is M=/yy.l      { <<== ????}


Regards....

Avatar of JimBob091197
JimBob091197

Hi

That is very strange.  I have never had that problem before.  Is OpenDialog1 a component on your form?  Did you accidently free it somewhere?

JB
I tried it but it works fine. (if you free it you got an exeption...)

Maybe you have to execute it first if you want some info from it.
opendialog.execute;
Maybe something in your system environment wrong...
Maybe you mistype something...


I tried it but it works fine. (if you free it you got an exeption...)

Maybe you have to execute it first if you want some info from it.
opendialog.execute;
Maybe something in your system environment wrong...
Maybe you mistype something...


I tried it but it works fine. (if you free it you got an exeption...)

Maybe you have to execute it first if you want some info from it.
opendialog.execute;
Maybe something in your system environment wrong...
Maybe you mistype something...


I tried it but it works fine. (if you free it you got an exeption...)

Maybe you have to execute it first if you want some info from it.
opendialog.execute;
Maybe something in your system environment wrong...
Maybe you mistype something...


st_simon: STOP HITTING SUBMIT!!
Try storing the whole string into an array of char before doing the showmessage. If you're using the application.ShowMessage, it uses a PChar, not a String, and Delphi 2.x, 3.x sometimes do weird things with strings and pchar's conversions.
ASKER CERTIFIED SOLUTION
Avatar of BoRiS
BoRiS

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of sergio_2001

ASKER

Hi all,

- The filename property is blank...
- I don't think that it's free before... It fails in new projects....
- I execute it first using:
procedure TMemoPadForm.Open1Click(Sender: TObject);
begin
     OpenDialog1.execute;
end;
- I don't know how I'll use pchar instead string with showmessage...
- I suspect it's one environment bug too....
- I'll look the fat...

Please send your comments....

Thanks....