Delegate Sub SetTextCallback(ByVal [text] As String) Public Sub SetText(ByVal [text] As String) ' InvokeRequired required compares the thread ID of the ' calling thread to the thread ID of the creating thread. ' If these threads are different, it returns true. If Me.Label.InvokeRequired Then Dim d As New SetTextCallback(AddressOf SetText) Me.Invoke(d, New Object() {[text]}) Else Me.Label.Text = [text] End If End Sub
SplashScreen.SetText("Chargement ...")
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionJ'y ai insere un objet Label dont je voudrai modifier le contenu au fil du changement du process.
Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim MySplashScreen As New SplashScreen1 MySplashScreen.Show() MySplashScreen.Update() For compteur As Int16 = 0 To 10 MySplashScreen.Label1.Text = "Texte N°" & compteur MySplashScreen.Update() System.Threading.Thread.CurrentThread.Sleep(1000) Next MySplashScreen.Close() MySplashScreen.Dispose() End Sub End Class