How to call subroutine in another form

mhmdh2000

Member
Joined
Sep 28, 2005
Messages
6
Programming Experience
5-10
I have form1 and form2
in form2 there is Sub abcd()
How can I call Sub abcd() from within form1?


In VB6, I add "Public" word before Sub abcd(), but this is not working with .NET
 
in form2 add either "Public" or "Friend" before the sub (Friend is recamended)

then simply use the variable for form2 to call that sub:
VB.NET:
Private frm2 As New Form2

Private Sub Button1_Click (...) Handles Button1.Click
  frm2.Show()
End Sub

Private Sub Button2_Click (...) Handles Button2.Click
  frm2.abc()
End Sub
 
Back
Top