473,387 Members | 1,834 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,387 software developers and data experts.

Wait for user response on opened form

I am writing a program that has a portion which downloads files into a
selected directory. It first checks to see if the file exists if the
file exists it opens another form with buttons related to
overwriting, renaming etc. What is the proper way in windows forms
programming to open a new form and wait for the reponse of the form.
Currently I open it with form.show(); form.focus(); In the form I have
a variable set based on the user's input and I would like the program
to halt until there is a response. Related to this I would like the
new form to have focus and maintain focus. i.e. I don't want the
user to be able to navigate back to the mainform and have access to
that functionality. Your help is greatly appreciated.

Nov 16 '05 #1
3 17059
HooHa wrote:
I am writing a program that has a portion which downloads files into a
selected directory. It first checks to see if the file exists if the
file exists it opens another form with buttons related to
overwriting, renaming etc. What is the proper way in windows forms
programming to open a new form and wait for the reponse of the form.
Currently I open it with form.show(); form.focus(); In the form I have
a variable set based on the user's input and I would like the program
to halt until there is a response. Related to this I would like the
new form to have focus and maintain focus. i.e. I don't want the
user to be able to navigate back to the mainform and have access to
that functionality. Your help is greatly appreciated.


Try form.ShowDialog();
--
to reply, remove .s.p.a.m. from email
Nov 16 '05 #2
Open the second form as a modal dialog. When calling the form from within
your first form:

form2.ShowDialog(this); // this - your first form - is the owner of
the modal dialog

Form 2 will behave lilke a modal dialog now (such as the OpenFileDialog and
similar classes) and any code after the ShowDialog() method is not executed
until the modal dialog is closed.

Hope that helps.

--
Kai Brinkmann [MSFT]

Please do not send e-mail directly to this alias. This alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.
"HooHa" <js*****@cox-dot-net.no-spam.invalid> wrote in message
news:41********@Usenet.com...
I am writing a program that has a portion which downloads files into a
selected directory. It first checks to see if the file exists if the
file exists it opens another form with buttons related to
overwriting, renaming etc. What is the proper way in windows forms
programming to open a new form and wait for the reponse of the form.
Currently I open it with form.show(); form.focus(); In the form I have
a variable set based on the user's input and I would like the program
to halt until there is a response. Related to this I would like the
new form to have focus and maintain focus. i.e. I don't want the
user to be able to navigate back to the mainform and have access to
that functionality. Your help is greatly appreciated.

Nov 16 '05 #3
Thank you both for your answers! That is exactly what I needed.

Cheers

Nov 16 '05 #4

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

Similar topics

0
by: s_erez | last post by:
Hi, This is a realy tricky one. I have an ASP.NET application where some pages are reading data from a DB and presenting reports. In order for the user to wait while the page is reading data from...
1
by: batham | last post by:
Gurus, I have a mainpage.aspx webform, in the page load of this page I am displaying a text "Please wait connecting..." and then I want the user to see this output on the WebForm, while I do...
4
by: dave | last post by:
Hi guys I display one page in popup window...that fetches some data from sql and perfom some calculation (tht approx 10 secs) and display result.... I am trying to display "Please wait ..."message...
7
by: CJM | last post by:
I have a page on our intranet that is supposed to stream an Excel sheet to the user. I'm using pretty standard code: sFilePath = sFileDir & sFilename Response.AddHeader...
4
by: puja patel | last post by:
hi all, I am developing a shopping cart website in C# where after selecting item, user enters credit card details and click on submit button.This request is then processed by the gateway which...
0
by: Gentian Hila | last post by:
I have a crystal report that is being displayed on the web (asp.net – VS studio 2003). I use a wait page, a very simple one, to tell the user to wait until the report is displayed, simply...
3
by: tylo | last post by:
Hello, I am using "Sub Main" to open many forms, one at a time. The problem is, there's no default built-in way of keeping Sub Main from going onto the next line of code while the user is supposed...
8
by: jimatqsi | last post by:
I have a form that opens another form. I want the first form to wait for the form it opened to be filled out before it proceeds with processing what comes after the opening of the other form. In...
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: 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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.