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

Waiting for an event

I have a form that needs to take input from another form. Problem is I can't
see any way to pause the sequence in the main form to wait for input from
the second form.
prompt = new AddressPrompt();
prompt.Show();
// Wait for click event in prompt
if (prompt.okay)
address[index] = prompt.addressInput;
Is there any way to do this? I've thought about creating a public method in
the main form, but I don't think there's a way to reference the open window.
Jon Cosby
Nov 16 '05 #1
1 1794
So, you are basically trying to show a dialog, then use information that the
user input into the dialog to continue your processing?

If that's correct, it sounds as though you want to show the AddressPrompt()
form modally.
Do a couple of things:

On "Ok" button on the AddressPrompt form, set its DialogResult property to
Ok. Set the Cancel Button's DialogResult to cancel. You can do this in the
form designer.

Then, you can use this code:
prompt = new AddressPrompt();
// show the prompt modally, and check whether the user
// selected Ok or cancel:
DialogResult result = AddressPrompt.ShowDialog(this);
if(result == DialogResult.OK)
address[index] = prompt.addressInput;
else
// user cancelled the dialog

"Jon Cosby" <jc****@nospam.net> wrote in message
news:zA******************@newsread2.news.pas.earth link.net...
I have a form that needs to take input from another form. Problem is I can't see any way to pause the sequence in the main form to wait for input from
the second form.
prompt = new AddressPrompt();
prompt.Show();
// Wait for click event in prompt
if (prompt.okay)
address[index] = prompt.addressInput;
Is there any way to do this? I've thought about creating a public method in the main form, but I don't think there's a way to reference the open window.

Jon Cosby

Nov 16 '05 #2

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

Similar topics

44
by: Charles Law | last post by:
Hi guys. I'm back on the threading gig again. It's the age-old question about waiting for something to happen without wasting time doing it. Take two threads: the main thread and a worker...
3
by: Douwe | last post by:
I'm trying to write a piece of C code that has two threads: The first thread waits for a socket connection. The second thread is in a continues cycle waiting for an period of time (lets say 500 ms)...
44
by: Charles Law | last post by:
Hi guys. I'm back on the threading gig again. It's the age-old question about waiting for something to happen without wasting time doing it. Take two threads: the main thread and a worker...
44
by: Charles Law | last post by:
Hi guys. I'm back on the threading gig again. It's the age-old question about waiting for something to happen without wasting time doing it. Take two threads: the main thread and a worker...
0
by: =?Utf-8?B?QmlsbEI=?= | last post by:
This is a tough one... My Windows Service app periodically performs some processing on new entries to a SQL Server database table. It uses a simple System.Timer to call the Elapsed event...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.