I think that the best practice, most flexible and scalable way to do that is to declare and fire an event in your class and capture that event with Form1. Pass the data you want to display as an event parameter.
In Form1, you'd set it up as such:
+++++++++++++++++++++++++++ . . 'In declarations section of your form... Private WithEvents classInstanceVar1 As MyFirstClass Private WithEvents classInstanceVar2 As MySecondClass
Public Sub SetLabel1Text(ByVal data As String) Handles classInstanceVar.InfoEvent Label1.Text = data End Sub . . +++++++++++++++++++++++++++
In your MyFirstClass class here's code example of setting up and raising event to pass text for label1... +++++++++++++++++++++++++++ Public Class MyFirstClass
Public Event InfoEvent(ByVal infoText As String)
Public Sub SomeSubroutineThatRaisesEvent() 'tell everybody who's listening to me, that I'm starting this job... RaiseEvent InfoEvent("Hey Form1, I started doing some work...") 'do some work here... 'tell everyone I'm done doing work above... RaiseEvent InfoEvent("Hey Form1, I'm done doing part X of job Y") 'do some more work here... End Sub
End Class +++++++++++++++++++++++++++
|