By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,219 Members | 2,140 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,219 IT Pros & Developers. It's quick & easy.

Calling Event Procedures

P: n/a
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
Nov 21 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
Try cmdButton.PerformClick()

[]s
Cesar
"Robert Boudra" <rb*****@comcast.net> escreveu na mensagem
news:%2***************@TK2MSFTNGP15.phx.gbl...
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

Nov 21 '05 #2

P: n/a
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
Nov 21 '05 #3

P: n/a
"Robert Boudra" <rb*****@comcast.net> schrieb:
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?


See:

<URL:http://groups.google.de/group/microsoft.public.dotnet.languages.vb/msg/7f99b7d181575b20>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #4

P: n/a
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.

Nov 21 '05 #5

P: n/a
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
Nov 21 '05 #6

P: n/a
Cor Ligthert [MVP] wrote:
Chris in my message is

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


Doh! I missed that.

Nov 21 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.