1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| Public Class WebForm1
Inherits System.Web.UI.Page
Public Async Function ExecuterCommandeAsynchrone() As Task
' Votre code pour exécuter la commande ici
Await Task.Delay(10000) ' Exemple de délai de 10 secondes, remplacez cela par votre commande réelle
' La méthode se termine ici une fois la commande terminée
End Function
Protected Async Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
' Appeler la méthode asynchrone
Await ExecuterCommandeAsynchrone()
' Le code ici reprendra une fois que la commande asynchrone est terminée
' Vous pouvez mettre à jour l'interface utilisateur ou effectuer d'autres actions nécessaires ici
Me.Timer1.Enabled = True
End Sub
Protected Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
Me.Label1.Text = Me.Label1.Text & "."
End Sub
End Class |
Partager