Hi,
There is several ways of doing it:
1- Button.Enabled = false
2- keeping a flag ( bool variable ) :
bool used= false;
void onclick(.... )
{
if ( used ) return;
used = true;
3- Unhook the event handler:
Form1_OnLoad( .... )
{
EventHandler ev = new EventHandler( onClick );
button1.Click += ev;
}
void onClick(... )
{
buttton1.Click -= ev;
}
4- Hide the button :
button1.Visible = false;
I would use number 1 , in this case the user see that the button is disabled
and is aware that clicking on it will have no effect.
Cheers,
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"juli" <ji****@gmail.com> wrote in message
news:1f**************************@posting.google.c om...
Hello dear ppl!
Do someone know how can I invoke the on_click function of a button
only once?
I want some activity to happen only while I am pressing the button the
first time and not to happen on the other times.
Is it possible? If so,how?
Thanks a lot and Happy New Year!