Hi Randy,
Good design says that events should only be called in response to the event they are handling. If you have some code that needs to run in response to a command button click AND in response to something else you should move the code to its own method and call that from the Click() event and from wherever else it is you want to call it from.
That said, 'sender' is a reference to the object that fired the event and System.EventArgs is a generic event arguments object for events that don't need specific arguments (like Control key, Shift key, mouse button down, etc). You could call it like:
cmdButton.Click(me, new System.EventArgs)
HTH,
R--
>hello all, i have a quick question. can i call the click event of a command button in VB.NET? In VFP, it is very simple - cmdButton.Click(); however, in VB.NET you it seems you have to add the parameters (sender, system.eventargs). I really don't understand what I am supposed to be sending. Can anyone give me some direction on this or am I going about this the wrong way by just using the statement - me.cmdButton.Click(send, eventargs)? Thanks for the help.
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement