Click here to Skip to main content
15,906,947 members
Home / Discussions / C#
   

C#

 
AnswerRe: how to access calendar Pin
Henry Minute7-Feb-11 14:40
Henry Minute7-Feb-11 14:40 
QuestionProblem with panels Pin
nighttrain_7-Feb-11 7:41
nighttrain_7-Feb-11 7:41 
AnswerRe: Problem with panels Pin
Luc Pattyn7-Feb-11 8:08
sitebuilderLuc Pattyn7-Feb-11 8:08 
GeneralRe: Problem with panels Pin
OriginalGriff7-Feb-11 8:17
mveOriginalGriff7-Feb-11 8:17 
AnswerRe: Problem with panels Pin
Luc Pattyn7-Feb-11 8:40
sitebuilderLuc Pattyn7-Feb-11 8:40 
AnswerRe: Problem with panels Pin
OriginalGriff7-Feb-11 8:14
mveOriginalGriff7-Feb-11 8:14 
GeneralRe: Problem with panels Pin
nighttrain_7-Feb-11 8:26
nighttrain_7-Feb-11 8:26 
GeneralRe: Problem with panels Pin
OriginalGriff7-Feb-11 8:35
mveOriginalGriff7-Feb-11 8:35 
It's clear enough! I would be tempted to have a generic routine which sets them all invisible and then set only the one I want visible though:
private void toolStripSplitButton2_ButtonClick(object sender, EventArgs e)
{
    SetVisible(panel1);
}

private void toolStripButton1_Click(object sender, EventArgs e)
{
    SetVisible(panel2);
}

private void toolStripButton2_Click(object sender, EventArgs e)
{
    SetVisible(panel3);
}

private void SetVisible(Panel p)
{
    panel1.Visible = false;
    panel2.Visible = false;
    panel3.Visible = false;
    p.Visible = true;
}
For just three panels, I would be happy enough with that: to go any higher, I would use a loop instead:
private void SetVisible(Panel p)
{
    foreach (Control c in Controls)
    {
        Panel pan = c as Panel;
        if (pan != null)
        {
            pan.Visible = false;
        }
    }
    p.Visible = true;
}

Oh, and I would get rid off your names! Don't use "panel1", "panel2", "tool_stripButton2" etc.: use names that describe what they contain. "panColors" and "panFonts", "tsbSelectColors" and "tsbSelectFonts" help the readability of your code a lot, and that makes it easier to debug and work with.
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.

Digital man: "You are, in short, an idiot with the IQ of an ant and the intellectual capacity of a hose pipe."

GeneralRe: Problem with panels Pin
nighttrain_7-Feb-11 8:43
nighttrain_7-Feb-11 8:43 
GeneralRe: Problem with panels Pin
OriginalGriff7-Feb-11 8:48
mveOriginalGriff7-Feb-11 8:48 
GeneralRe: Problem with panels Pin
nighttrain_7-Feb-11 8:55
nighttrain_7-Feb-11 8:55 
AnswerRe: Problem with panels Pin
Bassio8-Feb-11 0:55
Bassio8-Feb-11 0:55 
QuestionWebBrowser in Windows applications Pin
Zeyad Jalil7-Feb-11 7:05
professionalZeyad Jalil7-Feb-11 7:05 
AnswerRe: WebBrowser in Windows applications Pin
Luc Pattyn7-Feb-11 8:13
sitebuilderLuc Pattyn7-Feb-11 8:13 
QuestionMysqldatabase connexion Pin
Pierre besquent7-Feb-11 5:34
Pierre besquent7-Feb-11 5:34 
AnswerRe: Mysqldatabase connexion Pin
Umair Feroze7-Feb-11 6:51
Umair Feroze7-Feb-11 6:51 
GeneralRe: Mysqldatabase connexion Pin
Pierre besquent7-Feb-11 21:01
Pierre besquent7-Feb-11 21:01 
AnswerRe: Mysqldatabase connexion Pin
OriginalGriff7-Feb-11 8:24
mveOriginalGriff7-Feb-11 8:24 
AnswerRe: Mysqldatabase connexion Pin
RaviRanjanKr9-Feb-11 3:59
professionalRaviRanjanKr9-Feb-11 3:59 
QuestionFileSystemWatcher how to wait for file copy completion? Pin
Chesnokov Yuriy7-Feb-11 4:02
professionalChesnokov Yuriy7-Feb-11 4:02 
AnswerRe: FileSystemWatcher how to wait for file copy completion? Pin
Thomas Krojer7-Feb-11 4:09
Thomas Krojer7-Feb-11 4:09 
AnswerRe: FileSystemWatcher how to wait for file copy completion? Pin
Chesnokov Yuriy7-Feb-11 7:18
professionalChesnokov Yuriy7-Feb-11 7:18 
AnswerRe: FileSystemWatcher how to wait for file copy completion? Pin
#realJSOP7-Feb-11 4:24
professional#realJSOP7-Feb-11 4:24 
AnswerRe: FileSystemWatcher how to wait for file copy completion? Pin
Ennis Ray Lynch, Jr.7-Feb-11 4:26
Ennis Ray Lynch, Jr.7-Feb-11 4:26 
AnswerRe: FileSystemWatcher how to wait for file copy completion? Pin
Luc Pattyn7-Feb-11 4:30
sitebuilderLuc Pattyn7-Feb-11 4:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.