Page 1 of 1

VBDOS Pro 1.0: Remembering last dir. in a File|Save dialog?

Posted: Mon Mar 05, 2012 9:02 am
by Harry Potter
I have a Visual Basic program that uses the File|Open and File|SaveAs dialg boxes and want to peserve the last directoy usd by such dialog boxes--even if the use clicks Cancel. How do I do that? Or do I need to create my own?

Posted: Mon Mar 05, 2012 11:50 am
by burger2227
In QB64 we use a TYPE to set the dialog box settings.

http://qb64.net/wiki/index.php?title=Wi ... alog_Boxes

In VB you would look in the Dialog Box properties list and set InitDir. ".\" sets it to always be the current directory.

Cancel doesn't change anything, but it will stay in the last folder when you select a file with nothing in the setting box.

You can set the value in the program like this:

Cdlname.InitDir = "C:\"

Where Cdlname is the name you give the CDL object. That only works the first time it is used however.

Posted: Mon Mar 05, 2012 11:59 am
by Harry Potter
In VB you would look in the Dialog Box properties list and set InitDir. ".\" sets it to always be the current directory.
Okay, now how do I do that? I want to preserve the directory without changing the current system directory if possible even when the user hits Cancel.

Posted: Mon Mar 05, 2012 12:26 pm
by burger2227
Add 8 to the Cdlname.flag value or use cdlOFNNoChangeDir to stay in the current dir.

However it doesn't seem to stay there after a file is selected on my machine.

It always starts at the last folder you selected a file from.

http://msdn.microsoft.com/en-us/library/aa259317

Posted: Mon Mar 05, 2012 2:01 pm
by Harry Potter
I guess I didn't make myself clear: I'm using Visual Basic for DOS Professional 1.0.

Posted: Mon Mar 05, 2012 2:24 pm
by burger2227
NO YOU DIDN'T!