Single Button To Start and Stop?[RESOLVED]
I was woundering can you get a Single button to peform 2 Actions :
Start on First Click and then Stop when RE Clicked again??
Code:
private void command4_Click(object eventSender, System.EventArgs eventArgs)
{
if (toolStripStatusLabel1.Text = "blah blah blah";_
Timer1.Enabled = true);
}
else
{
PacketsLabel.Text = "0";
Timer1.Enabled = false;
}
I know that not Correct above but I think you get the Idea of what i'm trying to do.This should be Much easier than the last one...LOL
Thxs in advance.. :)
Re: Single Button To Start and Stop?
Sure, why not, just use a state management variable.
Code:
bool TimerOn=false; //(Put this at the class level not in the Proc)
if(TimerOn)
{
TimerOn=false;
//Do whatever else
}
else
{
TimerOn=true;
//Do whatever else
}
Re: Single Button To Start and Stop?[RESOLVED]
Thxs for the Help Appreicate it.. :)
Re: Single Button To Start and Stop?[RESOLVED]
This may or may not be of interest to you but the CheckBox control has an Appearance property that can be set to Button. It will look exactly like a Button control but operates as a toggle, so when you click it it stays depressed until you click it again. The depressed state corresponds to Checked = True. RadioButtons can behave like this too.
Re: Single Button To Start and Stop?[RESOLVED]
Cool...I'll keep that in mind jmcilhinney..Thxs :)