How to pass multiple parameters in thread in VB

前端 未结 8 1417
面向向阳花
面向向阳花 2020-12-30 05:31

I\'m looking to pass two or more parameters to a thread in VB 2008.

The following method (modified) works fine without parameters, and my status bar gets updated ver

相关标签:
8条回答
  • 2020-12-30 05:54

    Something like this (I'm not a VB programmer)

    Public Class MyParameters
        public Name As String
        public Number As Integer
    End Class
    
    
    
    newThread as thread = new Thread( AddressOf DoWork)
    Dim parameters As New MyParameters
    parameters.Name = "Arne"
    newThread.Start(parameters);
    
    public shared sub DoWork(byval data as object)
    {
        dim parameters = CType(data, Parameters)
    
    }
    
    0 讨论(0)
  • 2020-12-30 05:54
    Dim evaluator As New Thread(Sub() Me.testthread(goodList, 1))
    With evaluator
    .IsBackground = True ' not necessary...
    .Start()
    End With
    
    0 讨论(0)
提交回复
热议问题