if i click button first time I want display number 1 on textbox,
again if i click button second time display 2
keep on clicling number will increse
Button
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.
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
Marish Balasubramanian59 reputationPosted Oct 12, 2012, 2:17 AM EDT
if(TextBox1.Text=="")
{
TextBox1.Text="1" ;
}
else
{
TextBox1.Text=int.parse(TextBox1.Text)+1;
}
VulpesRank #55 · 29.2K reputationPosted Oct 12, 2012, 2:19 AM EDT
private int number = 0;
private void button1_Click(object sender, EventArgs e)
{
number++;
textBox1.Text = number.ToString();
}