Hi,my name is yawar i am a student learning c#.I have combobox,when i select an item in combobox there comes data which i want to display on labels,but my problem is there comes many data,i want to display only 3 labels when only 3 data rows comes from database and when 4 data rows comes i want to diplay 4 labels.please help me.
yawar260 0 Newbie Poster
Recommended Answers
Jump to Post>creating labels at runtime.
Instantiate the control class and add this object into form collection.
... Label sam1=new Label(); sam1.Text="something."; sam1.Location=new Point(30,30); this.Controls.Add(sam1); ...
Jump to PostCould you please specify what exactly it is you want, because adatapost has given you the code to create a label at runtime. If it can be done once it can be done 3 or 4 times or more also.
Jump to PostPerhaps showing some code would help. Untill now I think you mean something like this:
public partial class Form1 : Form { public Form1() { InitializeComponent(); // if we want to make 3 labels we could do this: Label Label1 = new Label(); //create a label Label1.Location …
All 11 Replies
kvprajapati 1,826 Posting Genius Team Colleague
yawar260 0 Newbie Poster
ddanbe 2,724 Professional Procrastinator Featured Poster
yawar260 0 Newbie Poster
ddanbe 2,724 Professional Procrastinator Featured Poster
yawar260 0 Newbie Poster
ddanbe 2,724 Professional Procrastinator Featured Poster
jmosquera1987 0 Newbie Poster
Santhosh_3 0 Newbie Poster
ddanbe 2,724 Professional Procrastinator Featured Poster
Santhosh_3 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.