PDA

Click to See Complete Forum and Search --> : calling a sub


quadrac
Jun 8th, 2002, 07:27 AM
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....

Frans C
Jun 8th, 2002, 09:04 AM
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.

quadrac
Jun 8th, 2002, 09:25 AM
thanks!

wolfofthenorth
Jun 8th, 2002, 11:23 AM
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.

:)

quadrac
Jun 8th, 2002, 11:39 AM
i tried null, void, zero, 0, -1 and a few others
but i didn't try NOTHING!

:)