Solved

Access the panel on which a clicked button resides

Posted on 2004-04-01
3
234 Views
Last Modified: 2010-04-15
Is it possible to replace this

private void buttonClose_Click(object sender, System.EventArgs e)
{
      this.panelPageEdit.Enabled = false;
      this.panelPageEdit.Visible = false;
      this.panelMainMenu.Enabled = true;
      this.panelMainMenu.Visible = true;
}

with a function that will disable and make invisible any panel depending on which panel the button clicked resides on? In other words I want to access the panel in which 'sender' is on. panelMainMenu will always be the panel I want to enable and make visible so that can stay the same.

Thanks.
0
Comment
Question by:wjdashwood
3 Comments
 
LVL 12

Assisted Solution

by:dfiala13
dfiala13 earned 230 total points
ID: 10731873
private void buttonClose_Click(object sender, System.EventArgs e)
{
   Button btn = (Button)sender;
   Panel p = (Panel)btn.Parent;

     p.Enabled = false;
     p.Visible = false;
     this.panelMainMenu.Enabled = true;
     this.panelMainMenu.Visible = true;



}
0
 
LVL 5

Accepted Solution

by:
AdrianJMartin earned 170 total points
ID: 10731896
private void buttonClose_Click(object sender, System.EventArgs e)
{
      Button b = (Button)sender;
      b.Parent.Visible = false ;
}
0
 

Author Comment

by:wjdashwood
ID: 10731898
Top dorris!

Cheers.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
which object should i use (efficiency) 5 46
C# Error - Add Failed 12 78
Icons and Colors for Terms 3 24
Device Location 3 13
Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now