Use one form instead of multiple forms

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
 
P

Peter Duniho

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
 
M

MikeY

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
 
P

Peter Duniho

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top