We Recommend

Beginning VB.NET Beginning VB.NET
Visual Basic .NET is the latest version of the most widely used programming language in the world, popular with professional developers and complete beginners alike. This book will teach you Visual Basic .NET from first principles. You'll quickly and easily learn how to write Visual Basic .NET code and create attractive windows and forms for the users of your applications.


Posted By

mafro on 04/13/07


Tagged

status


Versions (?)


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.