Use an event to alert the form of the status, that separates the processing
from the class instance
'For example, in your form:
Dim WithEvents m_prc As ProcessData = New ProcessData
Private Sub m_prc_Status(ByVal counter As Integer) Handles m_prc.Status
TextBox1.Text = counter.ToString
End Sub
Private Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click
m_prc.Execute()
End Sub
' In the class definition:
Public Class ProcessData
Public Event Status(ByVal counter As Integer)
Public Sub Execute()
For i As Integer = 0 To 5000000
If i Mod 5000 = 0 Then
RaiseEvent Status(i)
End If
Next
End Sub
End Class
"Art" <Ar*@discussions.microsoft.com> wrote in message
news:2B**********************************@microsof t.com...
Hi,
I have a main form for my project. It uses a routine in another class to
do
work on a file -- line by line. I'd like to have a text box on my form
display the lines, say every 5,000 -- so I can tell the progress. From
what
LITTLE I know it looks like I'd have to pass the form to the class so that
the class can refer back to the form and update the textbox. It seems to
me
that there must be a better way to handle this. Can anyone tell me the
right
way to do this?
Art