c# - How to First Form Timer Start from Second form -
i have tried many time access , change property of control timer code please me
public partial class form1 : form { public form1() { initializecomponent(); } } public partial class form2 : form { public form2() { initializecomponent(); } private void button2_click(object sender, eventargs e) { form1 frm = new form1(); frm.timer1.enabled = true; } }
and had tried on loading constructor
public partial class form1 : form { public form1() { initializecomponent(); } } public partial class form2 : form { form1 mainform; public form2(form1 mainform) { initializecomponent(); this.mainform=mainform; } public form2() { initializecomponent(); } private void button2_click(object sender, eventargs e) { mainform.timer1.enabled = true; } }
when use constructor on loading occurred exception error object reference not found please me .................... , regard muhammad azam khan
in form1:
public bool timerenable{ get{ return timer1.enabled;} set{ timer1.enabled = value; } }
in form2:
private void button2_click(object sender, eventargs e) { form1 frm = new form1(); frm.timerenable = true; }
Comments
Post a Comment