Solved

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

Posted on 2011-02-16
3
351 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
3 Comments
 
LVL 74

Accepted Solution

by:
käµfm³d   👽 earned 500 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

728 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now