Link to home
Start Free TrialLog in
Avatar of DragXSlay
DragXSlayFlag for United States of America

asked on

C# - Using the Same Window

I'm working on a small C# application.  I've been writing code in C and Java for several years now, but this is my first experience with C# and Windows Forms, so please excuse me if the question has a simple answer.  I'm sure it's in the MSDN library, but I don't have a copy installed and wasn't able to find what I was looking for online.

I have a form that has several different buttons.  When the button is clicked, I want what's on the form to change.  I basically am going to have a whole new set of options and form fields, so all the existing fields need to disappear.  I know I could do this by just opening a new window, but I want everything to take place within the same form the user is looking at.  Thanks in advance for any help.  
Avatar of gillgates
gillgates

Well you could use a tabcontrol and just switch between tabs when buttons are clicked.  Otherwise you have to do object.visible = false; for all of your objects...
Avatar of DragXSlay

ASKER

Is it possible to hide the tabs in a tab control so that the user doesn't see them and therefore doesn't know what's really happening?  Are there any good docs that you can recommend on the control?
You know, closing one form and bringing up another would be so much easier, and probably faster than re-doing all the controls.  Not to far mention easier to maintain.
ASKER CERTIFIED SOLUTION
Avatar of TheAvenger
TheAvenger
Flag of Switzerland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Forgot to mention: put the controls that have to be visible at start up on the first panel, those that have to be shown afterwards on the second. Thus you have to hide/show only one control (the panel) instead of all controls.
You can use the groupBox component in which you can drag drop components you want. Thus by creating such broupBoxes, you can actually make frames which you can show/hide by the functions BringtoFront()/SendtoBack. A proper usage will give best results and you wont need to open a new form which is not as efficient as this method is; also these will be hidden from the user.
Faiqq
Group boxes have borders, which is probably not wanted, so panels are better. The rest is the same as my solution
TheAvenger,

Thanks for the tip!  It worked perfectly.