Guest User

Untitled

a guest
Apr 27th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.87 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9.  
  10. namespace Homework
  11. {
  12.     public partial class Form1 : Form
  13.     {
  14.         private bool stopped;
  15.  
  16.         public Form1()
  17.         {
  18.             InitializeComponent();
  19.         }
  20.  
  21.         private void btngreeting_Click(object sender, EventArgs e)
  22.         {
  23.             stopped = !stopped;
  24.             btngreeting.Text = stopped ? "Start" : "Stop";
  25.         }
  26.  
  27.         private void timer1_Tick(object sender, EventArgs e)
  28.         {
  29.             if (stopped == false)
  30.             {
  31.                 if (lblhello.Text == "Hello")
  32.                     lblhello.Text = "Goodbye";
  33.                 else
  34.                     lblhello.Text = "Hello";
  35.             }
  36.         }
  37.     }
  38. }
Add Comment
Please, Sign In to add comment