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

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -