portroe,
By having a reference to an object of that class in the other procedure!
Either by creating the object in that procedure, or more then likely,
passing the object as a parameter.
Public Class Form1
Inherits System.Windows.Forms.Form
' other stuff omitted
Private Sub Command1_Click(...)
Dim joe As New Employee
MessageBox.Show(joe.ToString())
DisplayMessage(joe)
End Sub
End Class
Public Module MessageModule
Public Sub DisplayMessage(ByVal anEmployee As Employee)
MessageBox.Show(anEmployee.ToString())
End Sub
End Module
Remember that objects created from Classes are reference types, so passing
the object ByVal passes a copy of the reference to the object, there is only
a single actual object on the heap.
From where? Inside the same object, simply call the procedure. Outside, you
need a reference to the object and call the method (well, inside too, but we
don't see it).
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.