H2: Modify an OpenFileDialog folder location?

M

Mr. B

If you can set the 'initial' path of an OpenFileDialog box by something like
the following:

Dim FilesPath As String ' Files Path
FilesPath = "P:\Projects\"
FilesPath = OpenFileDialog1.InitialDirectory

HOW can you set a 'current' path?

For example:

My application has 2 OpenFileDialog boxes (#1 and #2). In #1, I use it to
select specific files.... then they get written to a TXT type file.

My 2nd OpenFileDialog box opens the TXT file, etc. Which will not necessarily
be in the Same Folder as #1 files!

What I want to achive is that IF I use #1 to select files in say Folder "A",
and then use #2 to open my TXT file (which is in a different Folder "B"), how
can I synch #1 Open folder location to match #2's? This is because I want to
open an existing TXT file and ADD more files from the same location as where
the TXT file is (using OpenFileDialog #1). Remember that I used #2 to Open
the TXT file!

Or will it be easier to simply change the File Open extension for #2 instead?

Regards,

Bruce
 
O

One Handed Man \( OHM - Terry Burns \)

If I understand you correctly . . .

fileDialog1.InitialDirectory = fileDialog2.InitialDirectory
fileDialog1.ShowDialog

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .

Time flies when you don't know what you're doing
 
M

Mr. B

With Deft Fingers, "One Handed Man \( OHM - Terry Burns \)"
If I understand you correctly . . .

fileDialog1.InitialDirectory = fileDialog2.InitialDirectory
fileDialog1.ShowDialog

Hmmm... I tried something like that and I didn't work.

What I was wanting to do was to Synchronize the two FileDialog's...

But I'm currently playing with only using One "FD" and switching back and
forth between their Drawing Filters. I've a few bugs to iron out, but it
seems to be the way I should have approached this at first.

Regrards,

Bruce
 
O

One Handed Man \( OHM - Terry Burns \)

Hold on, do you mean you want to sync them when they are both open ?

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .

Time flies when you don't know what you're doing
 
M

Mr. B

With Deft Fingers, "One Handed Man \( OHM - Terry Burns \)"
Hold on, do you mean you want to sync them when they are both open ?

Boy... I've never had this much difficulties in describing my issue :)

.... Sych them yes.... but not at the 'same' time.

For example... if #1 is used to select a file in folder "A", and #2 is used to
open a file in folder "B"... Now I go bak and use #1... it would like it to
look in folder "B" without me ckicking to the folder.

But, I don't think that there is a means to 'force' a specific folder... Other
than the "initial" start folder. So another folder 'after' the initial folder
has been used.

Not to worry.... I'm getting around it by changing the file string in #1.

But it would be of interest to know if the above 'could' be done.

Regards,

Bruce
 
O

One Handed Man \( OHM - Terry Burns \)

OK, then this is easy. At class level

Private LastUsedDialogOpenDirectory As String


When you use your DialogBoxes, set the LastUsedDirectory, if it is "", then
dont use it otherwise do !

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .

Time flies when you don't know what you're doing
 
M

Mr. B

With Deft Fingers, "One Handed Man \( OHM - Terry Burns \)"
OK, then this is easy. At class level

Easy for you maybe :)
Private LastUsedDialogOpenDirectory As String

When you use your DialogBoxes, set the LastUsedDirectory, if it is "", then
dont use it otherwise do !

Verryy intersting! That's great! Thanks muchly.

BTW, where does all this 'knowledge' come from? I mean, is there a book you
have that has all this 'hidden' stuff? Or what?

I guess with the 6+ books I have, unless I specifically know what to look for,
this sort of info is all but impossible to find.

Thanks muchly!

Bruce
 
O

One Handed Man \( OHM - Terry Burns \)

Mr B.

It's basically a case of going through the pain. After a while you have
tried lots of stuff, got stuck , got through it, etc.

One time in the future, someone will ask this question again, and you will
be ready !

;-)


Regards


--

OHM ( Terry Burns )
. . . One-Handed-Man . . .

Time flies when you don't know what you're doing
 
M

Mr. B

With Deft Fingers, "One Handed Man \( OHM - Terry Burns \)"
It's basically a case of going through the pain. After a while you have
tried lots of stuff, got stuck , got through it, etc.

One time in the future, someone will ask this question again, and you will
be ready !

True... like it is written...

"experience" is something you get After you need it"

:)

Thanks!

Bruce
 
O

One Handed Man \( OHM - Terry Burns \)

A truly excellent quote !

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .

Time flies when you don't know what you're doing
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top