I want to make a button which changes it's text as per click
means initially it sets the value to "CHeck in" later when it click it sets it value to "Check out" then again if it clicks then it will show "check in" again , what i have to do?
This is a discussion on Event Catchup time within the C# Programming forums, part of the General Programming Boards category; I want to make a button which changes it's text as per click means initially it sets the value to ...
I want to make a button which changes it's text as per click
means initially it sets the value to "CHeck in" later when it click it sets it value to "Check out" then again if it clicks then it will show "check in" again , what i have to do?
AbHHinaay
Is this what you're looking for?
Code:using System; using System.Drawing; using System.Windows.Forms; public class EventFrm : Form { private Button btn1; public EventFrm() { this.Text = "Check in and out"; btn1 = new Button(); btn1.Text = "Check in"; btn1.Location = new Point( 25, 15 ); btn1.Size = new Size( 70, 20 ); this.Controls.Add( btn1 ); btn1.Click += new EventHandler(Btn1_Clicked); } public void Btn1_Clicked( object ob, EventArgs e ) { if (btn1.Text =="Check in") { btn1.Text = "Check out"; } else if (btn1.Text =="Check out") { btn1.Text = "Check in"; } } public static void Main() { Application.Run( new EventFrm() ); } }