Dim t As New System.Threading.Thread(AddressOf test) t.Start() Sub test() Dim domaine As String = "xxxx" Dim usr As String = "yyyy" 'Tout dépend de comment tu charges tes variables '............. End Sub
Public Class Form1 'déclaration publique des variables Public domaine As String Public usr As String Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click for ... domaine= ValeurDomaineDeTaBDD usr = ValeurUsrDeTaBDD Dim t As New System.Threading.Thread(AddressOf test) t.Start() Next End Sub Sub test() 'utilisation de domaine et usr... '............. End Sub End Class
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question1700 thread et la ça fait mal
j'ai vraiment l'aire d'un con
Option Strict On Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim user As String() = {"titi", "tata", "toto"} Dim pass As String() = {"lili", "lala", "lolo"} For i As Integer = 0 To 2 Dim t As New System.Threading.Thread(AddressOf test) t.Start(New clsLogin(i, user(i), pass(i))) Next End Sub Sub test(ByVal params As Object) Dim Login As clsLogin = DirectCast(params, clsLogin) MessageBox.Show("thread #" & Login.NumeroThread.ToString & Environment.NewLine & _ "user= " & Login.User & Environment.NewLine & _ "pass= " & Login.Pass) End Sub End Class Public Class clsLogin Dim _numerothread As Integer,_user, _pass As String Sub New(ByVal NumeroThread As Integer, ByVal User As String, ByVal Pass As String) _numerothread = NumeroThread _user = User _pass = Pass End Sub ReadOnly Property NumeroThread As Integer Get Return _numerothread End Get End Property ReadOnly Property User As String Get Return _user End Get End Property ReadOnly Property Pass As String Get Return _pass End Get End Property End Class