"Hrvoje Voda" <hrvoje.voda@lu atech.com> wrote in message
news:df1229$nna $1@ss405.t-com.hr...[color=blue]
> How can I have more the one event on button click?
>
> First click --> one event
> Second click --> second event[/color]
You could make do with 1 event if you have the client's handler remove
itself and add another handler...
private void OnClick( object sender, ClickEventArgs e )
{
// Do something
myForm.Click -= new ClickEventHandl er( OnClick );
myForm.Click += new ClickEventHandl er( OnSecondClick );
}
private void OnSecondClick( object sender, ClickEventArgs e )
{
// Do something
myForm.Click -= new ClickEventHandl er( OnSecondClick );
myForm.Click += new ClickEventHandl er( OnClick );
}
Or, you could simply create a custom control with 2 events.
Hrvoje Voda wrote:[color=blue]
> How can I have more the one event on button click?
>
> First click --> one event
> Second click --> second event
>[/color]
Depends on your requirements. It sounds like some kind of state machine you are
after here. The state could be held in a class variable or even in the control
itself - the Tag property comes to mind. Or if a simple toggle is all you need
you can even do something really ugly like:
Hrvoje Voda wrote:[color=blue]
> How can I have more the one event on button click?
>
> First click --> one event
> Second click --> second event
>[/color]
Depends on your requirements. It sounds like some kind of state machine you are
after here. The state could be held in a class variable or even in the control
itself - the Tag property comes to mind. Or if a simple toggle is all you need
you can even do something really ugly like:
Comment