I want to make a button when you click it one time it will say "Stop" and when you click it a second time it will say "Start" and I'm new to visual studio and C# so it's taking time to research. So if anyone could help I would be honored.

so it's just a button that changed it's name when you click it.

Recommended Answers

All 3 Replies

What you need to do is handle the click event of the button, then check the current text of the button and act accordingly. To create the handler template, one of the easiest ways is to double-click the button and VS will automatically create the template, ready for you to add the code you need.

Thanks for the help, I figured it all out now, this is what I did to fix it.

private void button2_Click(object sender, EventArgs e)
{
            if  (button2.Text == "Stop")
            {
                button2.Text = "Go";
            }
            else if (button2.Text == "Go")
            {
                button2.Text = "Stop";
            }
}

Please remember to mark this solved. Thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.