Click here to Skip to main content
15,846,144 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
let assume i have 3 forms: form a,form b, form c. form a has a button that opens form b and form b also has a button that opens form c.
now i am in form a and i want to disable a button on form c when form b is clicked
Posted
Comments
george4986 25-Sep-14 2:49am    
post ur code here
MaximusDebois 25-Sep-14 3:50am    
this.Hide();
MainForm f = new MainForm();
f.Show();
f.logOutToolStripMenuItem1.Enabled = false;
f.logOutToolStripMenuItem.Enabled = false;
f.administratorsToolStripMenuItem.Enabled = false;
f.administratorsToolStripMenuItem1.Enabled = false;
f.teachersToolStripMenuItem.Enabled = true;
f.teachersToolStripMenuItem1.Enabled = true;
f.membersToolStripMenuItem.Enabled = true;
f.membersToolStripMenuItem1.Enabled = true;
f.visitorsToolStripMenuItem.Enabled = false;
f.visitorsToolStripMenuItem1.Enabled = false;
f.reportsToolStripMenuItem1.Enabled = false;
f.paymentRecordsToolStripMenuItem1.Enabled = false;
f.toolsToolStripMenuItem.Enabled = false;
f.helpToolStripMenuItem.Enabled = false;
f.AdminUser.Text = usernametxt.Text;
f.AdminUser.Image = Properties.Resources.people_resize;


this.Hide();

}
try
{
Members f = new Members();
f.membersaddnewbtn.Enabled = false;
f.memberssavebtn.Enabled = false;
f.membersupdatebtn.Enabled = false;
f.memebersdeletebtn.Enabled = false;
}
catch (Exception)
{

throw;
}
BillWoodruff 25-Sep-14 5:01am    
You show only code for the MainForm here. You should edit this to show the code where the two other Forms are created, then move this code into your original question, and properly format it with CodeProject's editor.
MaximusDebois 25-Sep-14 3:54am    
in the code it opens a form called mainform and when i clicked on f.membersToolStripMenuItem1 i want it disable some buttons on members form
BillWoodruff 25-Sep-14 4:15am    
What Form creates the instance of FormC: FormA, or FormB ?

"i want to disable a button on form c when form b is clicked"

Do you mean when the user clicks anywhere on FormB's area, or do you mean when the user clicks on some specific Control on FormB ?

1 solution

Form a could expose a (read-only) property stating if button on form c should be disabled or not.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900