Solved

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

Posted on 2011-02-16
3
357 Views
Last Modified: 2012-05-11
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 ??
0
Comment
Question by:Parth48
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 500 total points
ID: 34908437
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
 
LVL 9

Expert Comment

by:rawinnlnx9
ID: 34908458
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
 

Expert Comment

by:binh_vu54321
ID: 34931434
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

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

631 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question