Question:You are developing an application to perform mathematical calculations. You develop a class named CalculationValues. You write a procedure named PerformCalculation that operates on an instance of the class.
You need to ensure that the user interface of the application continues to respond while calculations are being performed. You need to write a code segment that calls the PerformCalculation procedure to achieve this goal.
Which code segment should you use?
A Private Sub PerformCalculation ( _
ByVal values As Object)
...
End Sub
Private Sub DoWork()
Dim myValues As New CalculationValues()
Dim newThread As New Thread( _
New ParameterizedThreadStart( _
AddressOf PerformCalculation))
newThread.Start(myValues)
End Sub
B Private Sub PerformCalculation ( _
ByVal values As CalculationValues)
...
End Sub
Private Sub DoWork()
Dim myValues As New CalculationValues()
Application.DoEvents()
PerformCalculation(myValues)
Application.DoEvents()
End Sub
C Private Sub PerformCalculation()
...
End Sub
Private Sub DoWork()
Dim myValues As New CalculationValues()
Dim delStart As New ThreadStart( _ AddressOf PerformCalculation)
Dim newThread As New Thread(delStart) If newThread.IsAlive
Then newThread.Start(myValues)
End If
End Sub
D Private Sub PerformCalculation()
...
End Sub
Private Sub DoWork()
Dim myValues As New CalculationValues()
Dim newThread As New Thread( _
New ThreadStart(AddressOf PerformCalculation))
newThread.Start(myValues)
End Sub