Click here to Skip to main content
13,054,329 members (121,388 online)
Rate this:
Please Sign up or sign in to vote.
I am doing a small 'Windows Forms' project. I have a situation where I have a few user controls.
Suppose the controls are:
UC_a, UC_b, UC_d, UC_e.... etc.

Now, I have a splitContainer and some radiobuttons in my main app window.
I want to load the user controls into the panel1 of spliContainer.

I do not want to add them all at once. Rather, it goes like this:
First, the user has to select one of the radio buttons.
Depending on this selection, the user controls get loaded.
Suppose the user has selected radiobutton1.
Now what i want is to first load UC_a.
Suppose UC_a contains a combobox and a checkbox. The user now has to select one value from the combobox and then check the checkbox. Only once the user has done these 2 actions must the main app load the next user control. Suppose UC_b is the next user control that has to be added to the splitcontainer.panel1.
UC_b may need the value that was selected by the user in UC_a and so, if UC_b is loaded prior to the user selecting the values in UC_a, it will throw error.
Now, some of these controls maybe loaded multiple times, ie, say, after UC_a is loaded, and the user has provided the necessary inputs, 5 or 10 separate instances of UC_b maybe created and added to the panel.
say, each UC_b has a checkbox and The user needs to select any 3 of these UC_b controls by checking their respective checkboxes. Once 3 UC_b has been selected, load UC_c and so on...

My question is: How do I make the main app wait for the user input in these user controls before continuing?
Posted 11-Apr-13 2:50am
princektd 11-Apr-13 8:53am
One obvious way to do a similar thing is to provide a 'wizard' like interface where the user does some action, then he has to click the 'NEXT' button upon which some verification/validation code maybe run to ensure that the user has infact provided the needed inputs and then proceed to the next screen. Other than such a 'next' button UI, what other way is there to handle the above mentioned situation?
ThePhantomUpvoter 11-Apr-13 12:05pm
"How do I make the main app wait for the user input", easy. Do nothing. That is the whole point of the Event Driven programming model. Simply do nothing until the user provides some input.

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

You could use a finite state machine - have a look around for the State Design Pattern
and have a look here Finite State Machine with Sub-state[^]

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 11 Apr 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100