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

If you have questions about any aspect of QBasic programming, or would like to help fellow programmers solve their problems, check out this board!

Moderators: Pete, Mods

Post Reply
Harry Potter
Veteran
Posts: 111
Joined: Sat Feb 21, 2009 8:19 am
Location: New York, U.S.

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

Post 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?
Joseph Rose, a.k.a. Harry Potter
Creating magic in the computer community...or at least striving to! :(
User avatar
burger2227
Veteran
Posts: 2466
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Post 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.
Last edited by burger2227 on Mon Mar 05, 2012 12:12 pm, edited 1 time in total.
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
Harry Potter
Veteran
Posts: 111
Joined: Sat Feb 21, 2009 8:19 am
Location: New York, U.S.

Post 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.
Joseph Rose, a.k.a. Harry Potter
Creating magic in the computer community...or at least striving to! :(
User avatar
burger2227
Veteran
Posts: 2466
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Post 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
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
Harry Potter
Veteran
Posts: 111
Joined: Sat Feb 21, 2009 8:19 am
Location: New York, U.S.

Post by Harry Potter »

I guess I didn't make myself clear: I'm using Visual Basic for DOS Professional 1.0.
Joseph Rose, a.k.a. Harry Potter
Creating magic in the computer community...or at least striving to! :(
User avatar
burger2227
Veteran
Posts: 2466
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Post by burger2227 »

NO YOU DIDN'T!
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
Post Reply