i want to create a textbox for single click and a label for double click on a picture box in windows form dynamically .
but when i give a double click it creates 2 text boxes for me but not a label. so please help me...!!
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Rahul PrajapatRank #1,209 · 1.5K reputationPosted Aug 27, 2015, 5:27 PM EDT
{
InitializeComponent();
Timer1.Interval = 300;
}
int a = 100;
private void pictureBox1_MouseClick(object sender, MouseEventArgs e)
{
Timer1.Start();
}
private void pictureBox1_MouseDoubleClick(object sender, MouseEventArgs e)
{
Timer1.Stop();
Label lbl = new Label();
lbl.Location = new Point(0 + a, 200);
lbl.Text = "Double Click";
this.Controls.Add(lbl);
a += 100;
}
private void create_TextBox()
{
TextBox tb = new TextBox();
tb.Location = new Point(0 + a, 300);
tb.Text = "Single Click";
this.Controls.Add(tb);
a += 100;
Timer1.Stop();
}
private void timer1_Tick(object sender, EventArgs e)
{
create_TextBox();
}
sai kiran reddy5 reputationPosted Aug 30, 2015, 7:56 AM EDT
Rahul PrajapatRank #1,209 · 1.5K reputationPosted Aug 30, 2015, 4:54 PM EDT
It helps to other.
sai kiran reddy5 reputationPosted Sep 3, 2015, 3:32 AM EDT