H2:修改OpenFileDialog文件夹位置? [英] H2: Modify an OpenFileDialog folder location?

查看:54
本文介绍了H2:修改OpenFileDialog文件夹位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果您可以通过以下方式设置OpenFileDialog框的''initial''路径:


Dim FilesPath As String''文件路径

FilesPath =" P:\Projects \"

FilesPath = OpenFileDialog1.InitialDirectory


怎么办你设置一个''当前'路径?


例如:


我的应用程序有2个OpenFileDialog框(#1和#2) 。在#1中,我用它来
选择特定文件....然后它们被写入TXT类型文件。


我的第二个OpenFileDialog框打开TXT文件等等。这些文件不一定与#1文件在同一个文件夹中!


我想要实现的是如果我使用#1选择文件夹中的文件A,

然后用#2打开我的TXT文件(位于不同的文件夹B中),如何

我可以同步#1打开文件夹位置以匹配#2'的?这是因为我想打开一个现有的TXT文件并从TXT文件所在的位置添加更多文件(使用OpenFileDialog#1)。请记住,我用#2打开了

TXT文件!


或者更简单地更改#2的文件打开扩展名会更容易吗? br />

问候,


布鲁斯

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

推荐答案

如果我理解你没错。 。 。


fileDialog1.InitialDirectory = fileDialog2.InitialDirectory

fileDialog1.ShowDialog


-


OHM(特里伯恩斯)

。 。 。单手人。 。


当你不知道自己在做什么时,过得很快


" Mr。 B" < US ** @ NoWhere.com>在消息中写道

news:bv ******************************** @ 4ax.com ...
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

"Mr. B" <Us**@NoWhere.com> wrote in message
news:bv********************************@4ax.com...
如果您可以通过
设置OpenFileDialog框的''initial''路径,如下所示:

Dim FilesPath As String''文件路径
FilesPath =" P:\Projects \"
FilesPath = OpenFileDialog1.InitialDirectory

如何设置当前路径?

例如:

我的应用程序有2个OpenFileDialog框(#1和#2)。在#1中,我用它来选择特定的文件....然后它们被写入TXT类型的文件。

我的第二个OpenFileDialog框打开TXT文件,等等。不是
必须与#1文件在同一个文件夹中!

我想要实现的是,如果我使用#1来选择文件夹
" A" ,然后使用#2打开我的TXT文件(位于不同的文件夹B中),
如何同步#1打开文件夹位置以匹配#2'?这是因为我想要
打开一个现有的TXT文件,并从与TXT文件所在的
相同的位置添加更多文件(使用OpenFileDialog#1)。请记住,我使用#2到
打开TXT文件!

或者更简单地更改#2
的文件打开扩展名?
问候,

布鲁斯
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



出于好奇,H2:是什么?在你的主题行中意味着什么?
Out of curiosity, what does "H2:" mean in your subject line?


使用Deft Fingers,Jeff Johnson [MVP:VB]" <我*** @ enough.spam>写道:
With Deft Fingers, "Jeff Johnson [MVP: VB]" <i.***@enough.spam> wrote:
出于好奇,H2:是什么?你的主题是什么意思?
Out of curiosity, what does "H2:" mean in your subject line?




如何(:


对不起..我认为这是一个常见的!


布鲁斯



How To (:

Sorry.. I thought that was a common one!

Bruce


这篇关于H2:修改OpenFileDialog文件夹位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆