Event Catchup time

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 ...

  1. #1
    Registered User planet_abhi's Avatar
    Join Date
    Oct 2002
    Posts
    92

    Event Catchup time

    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

  2. #2
    Registered User
    Join Date
    Mar 2005
    Location
    Mountaintop, Pa
    Posts
    1,059
    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() );
      }
    }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Read and set\change system time
    By Hexxx in forum C++ Programming
    Replies: 9
    Last Post: 01-02-2006, 06:11 AM
  2. delegate & event
    By Micko in forum C# Programming
    Replies: 5
    Last Post: 03-08-2004, 03:05 AM
  3. calculating user time and time elapsed
    By Neildadon in forum C++ Programming
    Replies: 0
    Last Post: 02-10-2003, 05:00 PM
  4. time class
    By Unregistered in forum C++ Programming
    Replies: 1
    Last Post: 12-11-2001, 09:12 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21