c# - How do I pass along variable in a custom control? -
i've created custom control in c# in vse, , appears on list on left. want pass along reference main form, , i'm doing in constructor. , i've manually edited, vse designer generated code pass along form itself. hereafter when try designview vse shows errormessage. have done wrong way?
class canvas : control { public canvas(form1 theform) { } }
and in designer generated code:
this.canvas2 = new panel2.canvas(this);
you use public property.
public form1 mainform { get; set; }
you can pass in parameter on canvas object.
<canvas mainform='<%= %>'></canvas>
or code:
this.canvas2.mainform = this;
Comments
Post a Comment