how can i create dynamic lable in C#.net windows application ??

i want to create dynamic lable in my C#.net windows application, not drag and drop from visual studio toolbox but creating it from code behind (in cs file) , but how can i do this ??
Parth48Asked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
käµfm³d 👽Connect With a Mentor Commented:
Create a new label; then add it to the appropriate control's Controls collection:
Label newLabel = new Label();

newLabel.Text = "Hello World!";

this.placeHolder1.Controls.Add(newLabel);

Open in new window

0
 
rawinnlnx9Commented:
This is a pretty concise example. Replace the textbox with label controls and you should be on your way. Please note that properties are a little bit different but this will explain how you do it.

http://support.microsoft.com/kb/317794

This search string will give you additional links that are right on so long as you stay in the first 5 or 10 hits.

http://www.google.com/#hl=en&sugexp=ool30&xhr=t&q=C%23+asp+create+controls+at+runtime&cp=0&pf=p&sclient=psy&site=&source=hp&aq=f&aqi=&aql=&oq=C%23+asp+create+controls+at+runtime&pbx=1&bav=on.1,or.&fp=5e2b21bd614e0a97

0
 
binh_vu54321Commented:
You can do that: drag a Label named lbTest. And Find lbTest in the design file. And copy that part of code into where you want to create the label. Remember to rename the control.
0
All Courses

From novice to tech pro — start learning today.