473,505 Members | 14,658 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Initialize OpenFileDialog

Hi, All,

I want to use the openfiledialog to open different extension files in
different directory( only one type files at one time). I set the
OpenFiledialog InitialDirectory and Filter property for ".dat" files at
first time, it works. When I try to use openfiledialog to set different
InitialDirectory an different Filter property for ".txt" files at
second time, I got frozen window. Even I added code to dispose
openfiledialog after using it, I still got frozen window. How to use
OpenFileDialog to open one type file in a directory and open another
type file in another directory next time?
Thinks a lot for your time and help!

Nov 21 '05 #1
6 2990
Can you post some simplied code that shows the problem?

chris

<ba**********@yahoo.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
Hi, All,

I want to use the openfiledialog to open different extension files in
different directory( only one type files at one time). I set the
OpenFiledialog InitialDirectory and Filter property for ".dat" files at
first time, it works. When I try to use openfiledialog to set different
InitialDirectory an different Filter property for ".txt" files at
second time, I got frozen window. Even I added code to dispose
openfiledialog after using it, I still got frozen window. How to use
OpenFileDialog to open one type file in a directory and open another
type file in another directory next time?
Thinks a lot for your time and help!

Nov 21 '05 #2
Can you post some simplied code that shows the problem?

chris

<ba**********@yahoo.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
Hi, All,

I want to use the openfiledialog to open different extension files in
different directory( only one type files at one time). I set the
OpenFiledialog InitialDirectory and Filter property for ".dat" files at
first time, it works. When I try to use openfiledialog to set different
InitialDirectory an different Filter property for ".txt" files at
second time, I got frozen window. Even I added code to dispose
openfiledialog after using it, I still got frozen window. How to use
OpenFileDialog to open one type file in a directory and open another
type file in another directory next time?
Thinks a lot for your time and help!

Nov 21 '05 #3
This works for me... Why are you disposing of the obj if you want to use it
again? That's not a good idea unless you New it again.

This works for me.

Dim X As New OpenFileDialog
X.InitialDirectory = "C:\Windows"
X.Filter = "(*.txt)|*.txt"
X.ShowDialog()
X.InitialDirectory = "C:\Windows\System32"
X.Filter = "(*.dll)|*.dll"
X.ShowDialog()

Chris
"Chris, Master of All Things Insignificant" <chris@No_Spam_Please.com> wrote
in message news:OB**************@TK2MSFTNGP11.phx.gbl...
Can you post some simplied code that shows the problem?

chris

<ba**********@yahoo.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
Hi, All,

I want to use the openfiledialog to open different extension files in
different directory( only one type files at one time). I set the
OpenFiledialog InitialDirectory and Filter property for ".dat" files at
first time, it works. When I try to use openfiledialog to set different
InitialDirectory an different Filter property for ".txt" files at
second time, I got frozen window. Even I added code to dispose
openfiledialog after using it, I still got frozen window. How to use
OpenFileDialog to open one type file in a directory and open another
type file in another directory next time?
Thinks a lot for your time and help!


Nov 21 '05 #4
This works for me... Why are you disposing of the obj if you want to use it
again? That's not a good idea unless you New it again.

This works for me.

Dim X As New OpenFileDialog
X.InitialDirectory = "C:\Windows"
X.Filter = "(*.txt)|*.txt"
X.ShowDialog()
X.InitialDirectory = "C:\Windows\System32"
X.Filter = "(*.dll)|*.dll"
X.ShowDialog()

Chris
"Chris, Master of All Things Insignificant" <chris@No_Spam_Please.com> wrote
in message news:OB**************@TK2MSFTNGP11.phx.gbl...
Can you post some simplied code that shows the problem?

chris

<ba**********@yahoo.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
Hi, All,

I want to use the openfiledialog to open different extension files in
different directory( only one type files at one time). I set the
OpenFiledialog InitialDirectory and Filter property for ".dat" files at
first time, it works. When I try to use openfiledialog to set different
InitialDirectory an different Filter property for ".txt" files at
second time, I got frozen window. Even I added code to dispose
openfiledialog after using it, I still got frozen window. How to use
OpenFileDialog to open one type file in a directory and open another
type file in another directory next time?
Thinks a lot for your time and help!


Nov 21 '05 #5
Thanks, Chris.

It is working for me now.

The reason I got error is when I am using three buttons to control
openFileDialog for three type files, I defined X as new OpenFileDialog
three times, the system displayed "can't handle...". So, I changed code
to define X only once, and reset initialDirectory and Filter when press
different buttons. It works.

Thanks, again.

Chris, Master of All Things Insignificant wrote:
This works for me... Why are you disposing of the obj if you want to use it again? That's not a good idea unless you New it again.

This works for me.

Dim X As New OpenFileDialog
X.InitialDirectory = "C:\Windows"
X.Filter = "(*.txt)|*.txt"
X.ShowDialog()
X.InitialDirectory = "C:\Windows\System32"
X.Filter = "(*.dll)|*.dll"
X.ShowDialog()

Chris
"Chris, Master of All Things Insignificant" <chris@No_Spam_Please.com> wrote in message news:OB**************@TK2MSFTNGP11.phx.gbl...
Can you post some simplied code that shows the problem?

chris

<ba**********@yahoo.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
Hi, All,

I want to use the openfiledialog to open different extension files in different directory( only one type files at one time). I set the
OpenFiledialog InitialDirectory and Filter property for ".dat" files at first time, it works. When I try to use openfiledialog to set different InitialDirectory an different Filter property for ".txt" files at
second time, I got frozen window. Even I added code to dispose
openfiledialog after using it, I still got frozen window. How to use OpenFileDialog to open one type file in a directory and open another type file in another directory next time?
Thinks a lot for your time and help!



Nov 21 '05 #6
Thanks, Chris.

It is working for me now.

The reason I got error is when I am using three buttons to control
openFileDialog for three type files, I defined X as new OpenFileDialog
three times, the system displayed "can't handle...". So, I changed code
to define X only once, and reset initialDirectory and Filter when press
different buttons. It works.

Thanks, again.

Chris, Master of All Things Insignificant wrote:
This works for me... Why are you disposing of the obj if you want to use it again? That's not a good idea unless you New it again.

This works for me.

Dim X As New OpenFileDialog
X.InitialDirectory = "C:\Windows"
X.Filter = "(*.txt)|*.txt"
X.ShowDialog()
X.InitialDirectory = "C:\Windows\System32"
X.Filter = "(*.dll)|*.dll"
X.ShowDialog()

Chris
"Chris, Master of All Things Insignificant" <chris@No_Spam_Please.com> wrote in message news:OB**************@TK2MSFTNGP11.phx.gbl...
Can you post some simplied code that shows the problem?

chris

<ba**********@yahoo.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
Hi, All,

I want to use the openfiledialog to open different extension files in different directory( only one type files at one time). I set the
OpenFiledialog InitialDirectory and Filter property for ".dat" files at first time, it works. When I try to use openfiledialog to set different InitialDirectory an different Filter property for ".txt" files at
second time, I got frozen window. Even I added code to dispose
openfiledialog after using it, I still got frozen window. How to use OpenFileDialog to open one type file in a directory and open another type file in another directory next time?
Thinks a lot for your time and help!



Nov 21 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
360
by: bobrad | last post by:
MAYBE SOMEBODY CAM HELP I AM USING THE FOLLOWING CODE TO GET A LOCATION OF A FILE IN A WINFORM DIALOG OpenFileDialog openFileDialog = new OpenFileDialog(); OpenFileDialog.Filter = " Access...
2
3067
by: don | last post by:
has anyone experienced problems with interactions between OpenFileDialog and FileStream? When I select "open" from an OpenFileDialog the subsequent calls to FileStream do not create a file. If I do...
4
7973
by: Nagachandra Sekhar Grandhi | last post by:
I am facing a problem with OpenFileDialog. It is as follows. I opened OpenFileDialog dialog box and selected a folder in it. After selecting the folder when i tried to delete the same folder in...
8
6030
by: e-mid | last post by:
why does not openFileDialog have closed event? i want to do something; as soon as the dialog closes. is there a way to do this?
0
314
by: barbara_dave | last post by:
Hi, All, I want to use the openfiledialog to open different extension files in different directory( only one type files at one time). I set the OpenFiledialog InitialDirectory and Filter...
8
6060
by: marcus.kwok | last post by:
I am having a weird problem and I have can't figure out why it is happening. I create an OpenFileDialog and set a filename filter. When the dialog first opens, the filter works correctly, and...
1
3759
by: sam | last post by:
OpenFileDialog appears to be "holding onto" the parent folder of a selected file until the application using the dialog quits. After creating a folder containing a file, I attempted to select...
3
3231
by: Martijn Mulder | last post by:
It strikes me that System.Windows.Forms.OpenFileDialog seems te 'remember' which directory it was in last, even when a new OpenFileDialog-object is created for every access to the file system....
0
2129
by: mbewers1 | last post by:
Hi I'm having a problem trying to get a customised OpenFileDialog() to fulfil my requirements. The code for this custom-built dialog has been taken from another site...
0
7216
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7098
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
7018
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7471
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5613
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5028
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4699
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1528
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
754
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.