473,499 Members | 1,903 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

about OpenFileDialog

hi
I wrote a windows based program.The main UI named
form_base has a button "btn1".In btn1`s click event
handler I used ShowDialog(this) to show another form
named form_test.form_test also has a button btn2 and I
added a openfiledialog in form_test.In btn2 click event
handler I used ShowDialog(this) to show openfiledialog.
When I ran the program, I found that when the
openfiledialog returned, the form_test would close
automatically and returned to form_base.What shall I do
if I want form_test to remain open when openfiledialog
close.

regards
violin
Jul 21 '05 #1
3 1546
Dear violin,

I used the following code:

Form1.cs

private void button1_Click(object sender,
System.EventArgs e)
{

Form2 frm2 = new Form2();
frm2.ShowDialog(this);
}

Form2.cs

private void button1_Click(object sender,
System.EventArgs e)
{
openFileDialog1.ShowDialog(this);
}

I have tried this out, on returning from the
OpenFileDialog, the form2 remains opened. Can you please
check. I think there must be some other reason for this.
Regards,
Puneet Taneja

-----Original Message-----
hi
I wrote a windows based program.The main UI named
form_base has a button "btn1".In btn1`s click event
handler I used ShowDialog(this) to show another form
named form_test.form_test also has a button btn2 and I
added a openfiledialog in form_test.In btn2 click event
handler I used ShowDialog(this) to show openfiledialog.
When I ran the program, I found that when the
openfiledialog returned, the form_test would close
automatically and returned to form_base.What shall I do
if I want form_test to remain open when openfiledialog
close.

regards
violin
.

Jul 21 '05 #2
Cor
Hi Violin,

Have a look at the form2 properties, to what the accept button is set, it is
maybe the button you use to open the opendialog.

Cor
hi
I wrote a windows based program.The main UI named
form_base has a button "btn1".In btn1`s click event
handler I used ShowDialog(this) to show another form
named form_test.form_test also has a button btn2 and I
added a openfiledialog in form_test.In btn2 click event
handler I used ShowDialog(this) to show openfiledialog.
When I ran the program, I found that when the
openfiledialog returned, the form_test would close
automatically and returned to form_base.What shall I do
if I want form_test to remain open when openfiledialog
close.

Jul 21 '05 #3
hi
Thanks you for answering my question.
I checked form2 and the btn2 is not the accept
button of form2.Actually I had serval buttons on form2.I
found that the form2 would close if I click any of these
buttons even I didn`t wrote click event handler for it.It
was so strange, so I deleted form2 and recreated it.This
time, form2 is remain open if i click any button on it.I
don`t know reason.Is there someone know it?
regards
violin
-----Original Me` ssage-----
hi
I wrote a windows based program.The main UI named
form_base has a button "btn1".In btn1`s click event
handler I used ShowDialog(this) to show another form
named form_test.form_test also has a button btn2 and I
added a openfiledialog in form_test.In btn2 click event
handler I used ShowDialog(this) to show openfiledialog.
When I ran the program, I found that when the
openfiledialog returned, the form_test would close
automatically and returned to form_base.What shall I do
if I want form_test to remain open when openfiledialog
close.

regards
violin
.

Jul 21 '05 #4

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
3063
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
7965
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
6025
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?
6
2986
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...
3
262
by: violin wang | last post by:
hi I wrote a windows based program.The main UI named form_base has a button "btn1".In btn1`s click event handler I used ShowDialog(this) to show another form named form_test.form_test also has a...
8
6055
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
3756
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...
0
2123
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
7134
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
7225
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6901
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
7392
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...
1
4920
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
4605
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
1429
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
667
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
307
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.