Link to home
Start Free TrialLog in
Avatar of Parth48
Parth48Flag for India

asked on

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 ??
ASKER CERTIFIED SOLUTION
Avatar of kaufmed
kaufmed
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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

Avatar of binh_vu54321
binh_vu54321

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.