I am working on winform application. i have one button and its default text is ON. now when I click on button, its text should be changed to OFF an if i again click the button. is text should be changed back to ON . i have no idea how to do so i used counter logic. but i am not sure in it and not comfortable withit.
one more thing. if text is ON then employee can receive notification. so accept_notf = 1 and if text is OFF employee can not receive notification. so accept_notf =0
i have tried this.:
private void btnNotification_Click(object sender, EventArgs e)
{
var btn = sender as Button;
if (btn != null)
{
if (btn.Text == "ON")
{
accept_notif = "1";
btn.Text = "OFF";
}
else (btn.Text == "OFF")
{
accept_notif = "0";
btn.Text = "ON";
}
}
}