Abdessamad,
The method that you attach is just that, a method, so you can call it
normally, passing the parameters that you want to pass. You can pass null,
like this:
// Call the event handler.
btnAdd_Click(null, null);
But you have to be careful, because the button handler code might be
depending on those parameters. Most likely, you will want to simulate a
button click like this:
// Call the event handler.
btnAdd_Click(btnAdd, EventArgs.Empty);
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
-
mv*@spam.guard.caspershouse.com
"Abdessamad Belangour" <be*******@irin.univ-nantes.fr> wrote in message
news:Ob**************@TK2MSFTNGP11.phx.gbl...
Hi all,
Suppose we have a method associated to a button object. Clicking on this
button triggers the associated method. for example : private void
btnAdd_Click(object sender, System.EventArgs e)
How can i do if i want to call it without the button been clicked ?
Thanks.