Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calling a function in another Class 1

Status
Not open for further replies.

paulcy82

Programmer
Jan 25, 2005
28
US
I have two Classes in my proj and I am trying to call a funct in Class2 from Class1's Form1_Load. How can I do this, below is a sample of my code.

Public Class1
Inherits System.Windows.Forms.Form
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
printRpt()
End Sub

Public Class2
public functionprintRpt()
''Do my printing
end function
end Class
 
In Class1 (or Form1):

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

dim clsClass2 as new Class2
clsClass2.printRpt
clsClass2=nothing

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top