Posted By

mafro on 04/13/07


Tagged

status


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

D4RKCODE


Status Label


 / Published in: VB.NET
 

Auto clearing status label for event reporting

  1. #Region "Status"
  2.  
  3. Private WithEvents StatusTimer As New Timer()
  4.  
  5.  
  6. Public Sub SetStatusText(ByVal value As String)
  7. lblStatus.Text = value
  8. End Sub
  9.  
  10. ''' <summary>Set status text and auto-clear after fixed number seconds</summary>
  11. ''' <param name="value">Text to display on status bar</param>
  12. ''' <param name="interval">Seconds to wait before clearing the status</param>
  13. Public Sub SetStatusText(ByVal value As String, ByVal interval As Int32)
  14. statusTimer.Interval = interval * 1000
  15. statusTimer.Start()
  16.  
  17. SetStatusText(value)
  18. End Sub
  19.  
  20. Public Sub ClearStatusText()
  21. lblStatus.Text = ""
  22. End Sub
  23.  
  24. ''' <summary>Clear StatusBar</summary>
  25. Private Sub ClearStatusText(ByVal sender As Object, ByVal e As EventArgs) Handles statusTimer.Tick
  26. lblStatus.Text = ""
  27. statusTimer.Stop()
  28. End Sub
  29.  
  30. #End Region

Report this snippet  

You need to login to post a comment.