Use one form instead of multiple forms

  • Thread starter Thread starter Tammy Nejadian
  • Start date Start date
T

Tammy Nejadian

Hi, I am going to write a large application using Visual Studio C#. I am
going to use only one Form as main menu and go to other pages by cliking on
next button in each page. I dont want to create several forms and move from
one form to next. However I need to have same action using only one form.
Could someone show me how I can use only one form instead of multiple forms.

Thanks
 
Hi, I am going to write a large application using Visual Studio C#. I am
going to use only one Form as main menu and go to other pages by cliking
on
next button in each page. I dont want to create several forms and move
from
one form to next. However I need to have same action using only one form.
Could someone show me how I can use only one form instead of multiple
forms.

I don't really understand why you don't want to have multiple forms.
There's no obvious reason that shouldn't work well for the scenario you
describe.

That said, an alternative would be to compose each page in a UserControl,
then put all the UserControls into the same Form, all in the same place.
Then control which UserControl is visible according to the buttons the
user pushes (starting out with the first page's UserControl being the only
one visible when you create the Form).

Pete
 
Yes I concure Dynamically is the only way (creating buttons, etc. as you
go). But for my 2 cents and from experience the coding adds up very quickly
and you end up fighting your code to figure out where you are in your
program, lol.

Cheers
 
Yes I concure Dynamically is the only way (creating buttons, etc. as you
go).

For what it's worth, that's not what I suggested at all.

To the OP: if you thought that _is_ what I suggested, please explain what
you didn't understand about my previous post and I'll try to clarify it.
But for my 2 cents and from experience the coding adds up very quickly
and you end up fighting your code to figure out where you are in your
program, lol.

I agree, putting together a UI dynamically is a royal pain. I'm going
through exactly that as I try to learn Java, and it's really annoying.

Fortunately, that's not what I suggested nor is it what the OP needs to
do. They can design UserControls in the VS Designer just like they can
design a Form, they can drop those into a Form just like they can drop any
other control, and they can even configure all but one to start out with
the Visible property set to false.

Pete
 
Back
Top