C# School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become a C# Expert!

Join 307,212 C# Programmers for FREE! Get instant access to thousands of C# experts, tutorials, code snippets, and more! There are 1,579 people online right now. Registration is fast and FREE... Join Now!




Dynamic GUI in Visual Studio, C#

 

Dynamic GUI in Visual Studio, C#

chad_nz

1 Jul, 2009 - 07:26 PM
Post #1

New D.I.C Head
*

Joined: 3 Jun, 2009
Posts: 24



Thanked: 1 times
My Contributions
Hi Everyone:

I'm making an application in order to manage an SQL Server Database through C#.

I'm designing the Administrator Windows form in which I'm allowing my administrator to perform different operations, e.g. add a new user, edit existing user, delete uset, etc.

Instead of selecting the option(combobox), click an apply button and then load a new Window form.

I want to create a Form that could show different embedded forms depending on the user's selection in within the same window.

I thought of a tabControl with as many tabPages as options but I can't seem to hide the tabPage Control Panel in order just to tab between then using code....

Is this possible? Any suggestions?

Many thanks! cool.gif

Carlos

User is offlineProfile CardPM
+Quote Post


SixOfEleven

RE: Dynamic GUI In Visual Studio, C#

1 Jul, 2009 - 09:14 PM
Post #2

lives.ToCode();
Group Icon

Joined: 18 Oct, 2008
Posts: 3,075



Thanked: 171 times
Dream Kudos: 825
Expert In: C, C#, XNA, Game Programming, Programming Concepts

My Contributions
I can think of at least one way. You could use panels. In each panel you will put the controls you want on the different forms on the panels. It would probably be best to design the panels on a blank form, the select everything and just copy it to your main form. When the administrator wants a specific panel, you should be able to set the Visible property of the panel you want to display to true and the others false. That should effectively switch panels giving the illusion that each panel is it's own separate form.

I'm not sure, but I think you can also just set the Enabled property of the panel to true to activate it and all of it's children and false to disable them.
User is offlineProfile CardPM
+Quote Post

chad_nz

RE: Dynamic GUI In Visual Studio, C#

1 Jul, 2009 - 09:54 PM
Post #3

New D.I.C Head
*

Joined: 3 Jun, 2009
Posts: 24



Thanked: 1 times
My Contributions
QUOTE(SixOfEleven @ 1 Jul, 2009 - 09:14 PM) *

I can think of at least one way. You could use panels. In each panel you will put the controls you want on the different forms on the panels. It would probably be best to design the panels on a blank form, the select everything and just copy it to your main form. When the administrator wants a specific panel, you should be able to set the Visible property of the panel you want to display to true and the others false. That should effectively switch panels giving the illusion that each panel is it's own separate form.

I'm not sure, but I think you can also just set the Enabled property of the panel to true to activate it and all of it's children and false to disable them.



SixOfEleven:

Cheers mate, It works like a charm!

Many thanks again!
User is offlineProfile CardPM
+Quote Post

janne_panne

RE: Dynamic GUI In Visual Studio, C#

1 Jul, 2009 - 10:02 PM
Post #4

D.I.C Addict
****

Joined: 9 Jun, 2009
Posts: 531



Thanked: 107 times
My Contributions
Here is a code to create your own tabcontrol which hides the header when the program is ran but shows the header while the program is in design state, so it is easy to work with it in the VS designer.

CODE

using System;
using System.Windows.Forms;

public class WizardPages : TabControl
{
    protected override void WndProc(ref Message m)
    {
        // Hide tabs by trapping the TCM_ADJUSTRECT message
        if (m.Msg == 0x1328 && !DesignMode)
           m.Result = (IntPtr)1;
        else
           base.WndProc(ref m);
    }
}


Copied from:
http://www.eggheadcafe.com/community/aspne...abpages-he.aspx
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 11/21/09 09:44PM

Live C# Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

C# Tutorials

Reference Sheets

C# Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month