Public Class frm_Sim_CalProgress
Inherits System. Windows. Forms. The Form
Dim t1 As Thread
Dim t2 As Thread
Dim t3 As Thread
Private Sub ButtonCalculation_Click (sender As Object, As EventArgs e) Handles ButtonCalculation. Click
T1=New Thread (AddressOf Me. GiveInfo)
T1. The Start ()
T2=New Thread (AddressOf Me. GiveProcName)
T2. The Start ()
T3=New Thread (AddressOf Me. Execute)
T3. The Start ()
End Sub
Which I put GiveInfo (), GiveProcName (), the Execute () to write in a module
Public Sub GiveInfo ()
Frm_Sim_CalProgress. PnlCalE. Text=FloatToStrF (CurE, ffFixed, 10, 2)
If CurE & lt; MaxE Then
Frm_Sim_CalProgress. ProgressBarCalE. Value=https://bbs.csdn.net/topics/
Frm_Sim_CalProgress. ProgressBarCalE. Maximum * (MaxE - CurE)/MaxE
The Else
Frm_Sim_CalProgress. ProgressBarCalE. Value=https://bbs.csdn.net/topics/0
End the If
End Sub
Public Sub GiveProcName ()
Frm_Sim_CalProgress. PnlProcName. Text=ProcName
End Sub
An error
CodePudding user response:
7 multi-threading has six qiao bird ^ ^CodePudding user response:
Where do you the meaning of writing multithreaded,With direct write
Me. GiveInfo
Me. GiveProcName
Me. The Execute
What is the difference, use new thread B? Neither asynchronous processing results, also do not need concurrent processing, the multi-threaded writing nonsense, don't want to use, it is recommended to use a task
CodePudding user response:
Your three processes inside the module, why are you in the form with Me? And your child thread is not directly to modify the main thread of the UI,CodePudding user response:
In the thread can't directly access controls, must use the entrust,CodePudding user response:
Suggest you use the task with lambda expressions, in c #=& gt; With the Function, vb.net, baidu will,CodePudding user response:
With the task should be betterCodePudding user response:
Dim t1 As New Task (Sub () Invoke (Sub GiveInfo () ()))
T1. The Start ()
Dim t2 As New Task (Sub () Invoke (Sub GiveProcName () ()))
T2. The Start ()
Dim t3 As New Task (Sub () Invoke (Sub () the Execute ()))
T3. The Start ()