Here is an idea for you to consider. It may not be what you are looking for, but I urge you to try it.
1. Create a blank VB project (Standard EXE).
2. on the form, add a command button and a label
3. Add a class module. Name it clsTest.
The work in the class module would represent your calculation process. In the class module, add this code.
Code:
Option Explicit
Public Event ProcessingStep(ByVal StepNumber As Integer, ByRef Cancel As Boolean)
Public Sub Process()
Dim iStart As Single
Dim bCancel As Boolean
RaiseEvent ProcessingStep(0, bCancel)
iStart = Timer
While (Timer - iStart) < 10
Wend
RaiseEvent ProcessingStep(1, bCancel)
If bCancel Then
Exit Sub
End If
iStart = Timer
While (Timer - iStart) < 10
Wend
RaiseEvent ProcessingStep(2, bCancel)
iStart = Timer
While (Timer - iStart) < 10
Wend
End Sub
You'll notice that I have a couple of loops that just wait a specified period of time. This, obviously, would be replaced with your calculation process.
Now, back to the form. Add this code.
Code:
Option Explicit
Public WithEvents oTest As clsTest
Private Sub Command1_Click()
Set oTest = New clsTest
Call oTest.Process
Label1.Caption = "Process Complete"
Set oTest = Nothing
End Sub
Private Sub oTest_ProcessingStep(ByVal StepNumber As Integer, Cancel As Boolean)
Label1.Caption = "Processing step " & CStr(StepNumber)
Label1.Refresh
End Sub
You'll notice that the command button begins the process. After each step in the process, an event is raised. In the event, we update the caption property of the label. then we refresh the label (so that it repaints). As each step is completed, the label is updated so the user knows something is still happening.
I hope this helps.
-George
Strong and bitter words indicate a weak cause. - Fortune cookie wisdom