Over a million developers have joined DZone.

Toggle Text On Button (Single Thread Application)

·
// description of your code here


 public partial class Form1 : Form
    {
        int iBtn = 0;
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            ++iBtn;

            if (iBtn == 3)
            {
                iBtn = 0;
            }

            switch (iBtn)
            {
                case 0: button1.Text = "default";
                    break;
                case 1: button1.Text = "Love";
                    break;
                case 2: button1.Text = "Hate";
                    break;
            }
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            button1.Text = "default";
        }
    }
Topics:

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}