Results 1 to 5 of 5

Thread: calling a sub

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jun 2002
    Posts
    16

    Question calling a sub

    hello:

    i have a sub:


    Private Sub CmdTrack0_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CmdTrack0.Click
    TrackNum = 0
    CmdTrack0.ImageIndex = 3
    End Sub

    all i want is to call the sub from another place,
    if it was VB6, I'd write:

    CmdTrack0_click()

    but it doesn't work with vb.net!

    please help me....

  2. #2
    old fart Frans C's Avatar
    Join Date
    Oct 1999
    Location
    the Netherlands
    Posts
    2,926
    Put the code in a different sub, and call it from your buttons click event, and from wherever you want.

    Although I used to call an eventhandler once in a while myselve, I don't see it as good coding practice. Well, maybe .NET will force us to get rid of these habbits.

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Jun 2002
    Posts
    16

    Smile I guess so...

    thanks!

  4. #4
    Addicted Member wolfofthenorth's Avatar
    Join Date
    Jan 2001
    Location
    Tatooine
    Posts
    169
    In your call statement CmdTrack0_click() , there aren't any parameters.

    You could try CmdTrack0_click(Nothing, Nothing) or whatever you decide the parameters should be.

    That which does not kill us, only makes us stronger.

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Jun 2002
    Posts
    16

    nothing hhhaaa?

    i tried null, void, zero, 0, -1 and a few others
    but i didn't try NOTHING!


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width