Solved

OpenDialog.Filename problem

Posted on 1998-03-22
9
197 Views
Last Modified: 2010-04-06
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....

0
Comment
Question by:sergio_2001
9 Comments
 
LVL 5

Expert Comment

by:JimBob091197
ID: 1360698
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
0
 

Expert Comment

by:st_simon
ID: 1360699
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...


0
 

Expert Comment

by:st_simon
ID: 1360700
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...


0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Expert Comment

by:st_simon
ID: 1360701
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...


0
 

Expert Comment

by:st_simon
ID: 1360702
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...


0
 
LVL 5

Expert Comment

by:JimBob091197
ID: 1360703
st_simon: STOP HITTING SUBMIT!!
0
 

Expert Comment

by:lato
ID: 1360704
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.
0
 
LVL 4

Accepted Solution

by:
BoRiS earned 10 total points
ID: 1360705
make sure you did not type M=/yy.l in the filename section of your opendialog option under the object inspector...

If the filename field is blank then showmessage should be blank....

If you are executing the opendialog and then showing the message then there is something wrong on that machine maybe the FAT structure are stuffed or something...

Later

BoRiS
0
 

Author Comment

by:sergio_2001
ID: 1360706
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....
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question