Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

About this user

Dave http://pedotnet.blogspot.com

« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS 

Toggle Text on Button (Single thread application)

// description of your code here

   1  
   2   public partial class Form1 : Form
   3      {
   4          int iBtn = 0;
   5          public Form1()
   6          {
   7              InitializeComponent();
   8          }
   9  
  10          private void button1_Click(object sender, EventArgs e)
  11          {
  12              ++iBtn;
  13  
  14              if (iBtn == 3)
  15              {
  16                  iBtn = 0;
  17              }
  18  
  19              switch (iBtn)
  20              {
  21                  case 0: button1.Text = "default";
  22                      break;
  23                  case 1: button1.Text = "Love";
  24                      break;
  25                  case 2: button1.Text = "Hate";
  26                      break;
  27              }
  28          }
  29  
  30          private void Form1_Load(object sender, EventArgs e)
  31          {
  32              button1.Text = "default";
  33          }
  34      }
« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS