Click here to Skip to main content
15,887,328 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
Let's say I wanted to make an options form. The object that contains it is called Options, for example. I want to be able to call a function in Options that would make it run, wait for the user to input values in the form and press okay, and then return a value. How could I design a function inside the Options class that waits for a button press before returning a value? Like this:

public partial class Options : Form
{
    public SomeClass Run(SomeClass defualts)
    {
         //Do some set up stuff like setting up the options with 
         //their default values or whatever I'd like
         
         //Wait for the user to press okay  <-- Need help here
         //then do this:
         return SomeVariable;
    }
}


Thanks :-D
Posted
Comments
Toli Cuturicu 12-Aug-10 8:48am    
Reason for my vote of 2
Not a function! A Form / Window!

1 solution

Sounds like you need a modal popup window. Google will give you at least a million examples.
 
Share this answer
 
Comments
Eastwinn 11-Aug-10 21:40pm    
Thank you! That's exactly what I wanted.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900