Thread: Event Catchup time

  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,058
    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, 07:11 AM
  2. delegate & event
    By Micko in forum C# Programming
    Replies: 5
    Last Post: 03-08-2004, 04:05 AM
  3. calculating user time and time elapsed
    By Neildadon in forum C++ Programming
    Replies: 0
    Last Post: 02-10-2003, 06:00 PM
  4. time class
    By Unregistered in forum C++ Programming
    Replies: 1
    Last Post: 12-11-2001, 10:12 PM