473,386 Members | 1,779 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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 1544
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
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
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
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
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
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
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
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
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
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
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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
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...

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.