CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Nov 2009
    Posts
    22

    Question showing different panel when radio button is clicked

    I have designed two radiobutton in Class Status.cs

    My panels are in class GetData.cs. GetData.cs contain two panel(panel1,panel2)one above(overlapped) the other.Panel2 is shown ,Panel 1 is behind panel2.

    if i click radiobutton1,panel 1 should be visible
    and if i click radiobutton2,panel 2 should be visible

    Now what i am doing is ,
    in Status.cs
    Code:
    private void radiobutton1 _CheckedChanged(object sender, EventArgs e)
            {
    
                Panel panel2 = getpanel.getPanelNonProd();
                Panel panel1 = getpanel.getPanelProd();
                panel2.Visible = false;
                panel1.Visible = true;
               
            }
    
            private void radiobutton2_CheckedChanged(object sender, EventArgs e)
            {
                Panel panel2 = getpanel.getPanelNonProd();
                Panel panel1 = getpanel.getPanelProd();
                panel2.Visible = true;
                panel1.Visible = false;
            }
    Initially in design panel2 is visible.And it doesnot change on clicking radiobutton 1 or 2..so what should i do here..
    Last edited by HanneSThEGreaT; June 29th, 2010 at 05:23 AM. Reason: Added CODE Tags

  2. #2
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,283

    Re: showing different panel when radio button is clicked

    Use either the SendToBack or BringToFront methods instead. Also, please use &#CODE] tags when posting code.

  3. #3
    Join Date
    Nov 2009
    Posts
    22

    Question Re: showing different panel when radio button is clicked

    Quote Originally Posted by HanneSThEGreaT View Post
    Use either the SendToBack or BringToFront methods instead. Also, please use &#CODE] tags when posting code.
    And can u tel me what is that and where to use it

  4. #4
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,283

  5. #5
    Join Date
    Nov 2009
    Posts
    22

    Re: showing different panel when radio button is clicked


    Its not working for me..I tried in Status.cs class

    private void radiobutton1_CheckedChanged(object sender, EventArgs e)
    {

    Panel panel2 = getpanel.getPanelNonProd();
    Panel panel1 = getpanel.getPanelProd();
    panel2.SendToBack();
    panel1.BringToFront();
    }
    Any suggestions?

    Moreover if i am using in the same class in which panel is kept
    panel2.SendToBack();
    panel1.BringToFront();
    This is working fine but from Status.cs class ,its not working...
    Last edited by @kriti; June 29th, 2010 at 07:18 AM. Reason: modified

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured