I have Form1 and Form2 simultaneously active, Form2 has a TabControl and I want button click event on Form1 to change 'Enable' property of tabControl on Form2
TabControl on Form2 is set to tabControl1.enabled = false;
and Form1 acts as a login form for Form2, so I need a Login button on Form1 to enable 'tabControl1' on Form2
I can access the property by setting private System.Windows.Forms.TabControl tabControl1;
to 'Public', still, using the following on button click event on Form1 doesn't do anything.
Form2 formnew2 = new Form2();
formnew2.tabControl1.Enabled = true;
Can someone please provide a simple example to help me understand or link to a previously answered question
Form2
designer, select thetabControl1
and using property window change theModifier
property of yourtabControl1
to bepublic
. Also make sure you are showing the instance that you made it's tab control disabled. Also if you settabControl1.enabled = false;
in form load event of form 2, the tabCorntrol will be disabled. – Reza AghaeiTabControl
on Form2 to be disabled by default. Note that I can enableTabControl
with a button click event on Form2 (the button obviously resides outsideTabControl
on Form2), but my objective is to enable it from Form1. BTW, Thanks for the Tip regardingModifier
. – Arasa RorEnable
property oftabControl1
to false from property window – Arasa RorApplication.OpenForms
– Reza Aghaei