simulate an event


M

Maileen

Hi,

I would like to know how to simulate an event in VB.NET ?
in fact, for example when user press enter in some special textbox, i
would like to raise a listview column click (for example).

Moreover, how to tell VB.NET that :
if user click on a button1, it is not the default button1_click() method
to execute, but another method...and maybe from another control...

i did it several times in C++...so it should exist something like that
in VB.NET.

thanks a lot,
Maileen
 
Ad

Advertisements

C

Chris

Maileen said:
Hi,

I would like to know how to simulate an event in VB.NET ?
in fact, for example when user press enter in some special textbox, i
would like to raise a listview column click (for example).

Moreover, how to tell VB.NET that :
if user click on a button1, it is not the default button1_click() method
to execute, but another method...and maybe from another control...

i did it several times in C++...so it should exist something like that
in VB.NET.

thanks a lot,
Maileen

You can use the addhandler keyword to connect a function with an event
on the fly. The only requirement is that signatures match up.

Chris
 
C

Cor Ligthert [MVP]

Maileen,

This is often asked, however why raise an event as you can call the
procedure from the event itself.

By instance this
Button1_Click(sender,nothing)

For the click there is as well performclick, however than the form should be
in showed state.

I hope this helps,

cor
 
Ad

Advertisements

H

Herfried K. Wagner [MVP]

Cor Ligthert said:
This is often asked, however why raise an event as you can call the
procedure from the event itself.

By instance this
Button1_Click(sender,nothing)

As always: I would not do that...
 

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

Top