simulate an event

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Maileen

    #1

    simulate an event

    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
  • Chris

    #2
    Re: simulate an event

    Maileen wrote:[color=blue]
    > 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[/color]

    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

    Comment

    • Cor Ligthert [MVP]

      #3
      Re: simulate an event

      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(s ender,nothing)

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

      I hope this helps,

      cor


      Comment

      • Herfried K. Wagner [MVP]

        #4
        Re: simulate an event

        "Cor Ligthert [MVP]" <notmyfirstname @planet.nl> schrieb:[color=blue]
        > This is often asked, however why raise an event as you can call the
        > procedure from the event itself.
        >
        > By instance this
        > Button1_Click(s ender,nothing)[/color]

        As always: I would not do that...

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

        Comment

        Working...