Unable to create a new Label on a Windows Forms Application when clicking a button (C#) -


i trying add new label when clicking on button. shouldn't difficult can't working :(

private void button3_click(object sender, eventargs e)     {         label label10 = new label();         label10.location = new point(23, 100);         label10.text = textbox1.text;         parent.controls.add(label10);     } 

i error when trying debug not explicit message:

"nullreferenceexception unhandled."

not sure may referring... using "new" keyword create new instance, may missing?

thanks!

is parent null? on there too. might call this.controls.add(...).


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? -