Click here to Skip to main content
15,881,730 members
Please Sign up or sign in to vote.
1.50/5 (2 votes)
See more:
Hi,

Every time I click on a Button, I want to build a new Label.
Posted
Updated 1-Nov-10 3:09am
v2
Comments
Nish Nishant 1-Nov-10 9:09am    
I've edited your question based on some assumptions as to what you meant.
shakil0304003 1-Nov-10 11:15am    
Not Clear!

Handle the Button's Click event, and in the handler, create a new Label control and add it to your form.
 
Share this answer
 
Comments
bita_gity 1-Nov-10 9:16am    
What's this code?
Tarun.K.S 1-Nov-10 9:23am    
what he meant is to do this :
Label myLabel=new Label(); on the Button's click event
bita_gity 1-Nov-10 9:51am    
After them I could move my mouse
Copy following code in the click event of button.
Don't forget to change the Location of button, next time...

C#
private void button1_Click(object sender, EventArgs e)
{
  System.Windows.Forms.Label lbl = new Label();
  lbl.Text = "Paras"
  lbl.Location = new System.Drawing.Point(0, 0);
  lbl.BackColor = System.Drawing.Color.Orange;
  this.Controls.Add(lbl);
}

:laugh: :-O
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900