Calling Event Procedures

  • Thread starter Thread starter Robert Boudra
  • Start date Start date
R

Robert Boudra

I want to cause a click event to occur on a Button control when the user
presses enter when the focus is on another control. In VB6, I would just
call the event procedure directly from the other control. However, in
VB.net, that doesn't seem to work. Can someone give me any idea of how to
do this?

Bob
 
Try cmdButton.PerformClick()

[]s
Cesar


"Robert Boudra" <[email protected]> escreveu na mensagem
I want to cause a click event to occur on a Button control when the user
presses enter when the focus is on another control. In VB6, I would just
call the event procedure directly from the other control. However, in
VB.net, that doesn't seem to work. Can someone give me any idea of how to
do this?

Bob
 
Bob,
I want to cause a click event to occur on a Button control when the user
presses enter when the focus is on another control. In VB6, I would just
call the event procedure directly from the other control. However, in
VB.net, that doesn't seem to work. Can someone give me any idea of how to
do this?


\\\
me.button_clickEvent(sender, nothing)
or for some who find that nicer if possible because that the same
eventargument is used
me.button_clickEvent(sender,e)
///

(This needeless text above because I normally get a message from Herfried
about this)

I use normally
\\\
me.button_clickEvent(nothing,nothing)
///
if I don't need the sender or the eventargument.

I don't use perform.click because that only works if the button is visible
and for that I don't want to check my program everytime by a change.

I hope this helps,

Cor
 
Cor Ligthert [MVP] wrote:
se normally
\\\
me.button_clickEvent(nothing,nothing)
///

What happens if the click event it wired to more than one button?
Passing Nothing into the sender property will prevent the code from
knowing which Button was clicked.

In my opinion, a better solution is to place to code that is executed
by the button click in a separate sub routine and call that directly
instead of calling the event procedure.
 
Chris in my message is

"if I don't need the sender or the eventargument".

Otherwise

me.button_clickEvent(sender,nothing)

Although your methode suits as well, a matter of preference.

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top