I want to display text in a StatusBar for 1000ms or maybe 2000ms. Do I need a timer, or is there a built in property in the StatusBar control for handling this?
And if I do need a timer, what's the syntax for using that?
Thanks,
CP
Printable View
I want to display text in a StatusBar for 1000ms or maybe 2000ms. Do I need a timer, or is there a built in property in the StatusBar control for handling this?
And if I do need a timer, what's the syntax for using that?
Thanks,
CP
you need to use a timer.
place the following code inside the tick event of a timer, and start the timer when you want the text to show.
VB Code:
Static counter as Integer If counter = 1 Then Timer1.Stop counter = 0 StatusBar1.Text = String.Empty Else counter += 1 StatusBar1.Text = "your text here" End If
EDIT: don't forget to set the timer interval to the required value.
Thanks for the help. Here's some more info . . .
I'm displaying various texts in the status bar depending on button clicks, etc. How do I display the text per click?
Example: I am using a delete button to delete a db record. Instead of showing a msgbox the the record has been deleted and forcing the user to click OK every time, I'd rather just display a message in the status bar for a couple of seconds.
Am I complicating this, or is it just a variation of what you already gave me?
Thanks!
CP
Just enable your timer in the click event of the delete button. Then when the ime has elapsed you disable your timer.
<kip>That sounds pretty good.</kip>
<lloyd>That sounds good, I'll try that</lloyd>
More info Rob ? Syntax?
Add a timer control to your form and add some code something like so.
VB Code:
Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.Timer1.Enabled = False Me.Timer1.Interval = 5000 'Miliseconds End Sub Private Sub tmrTimer_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles tmrTimer.Tick Me.StatusBarDescription.Text = String.Empty Me.Timer1.Enabled = False End Sub Public Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Me.StatusBarDescription.Text = "Processing Update..." Application.DoEvents() Me.Timer1.Enabled = True 'Do your update stuff '... '... End Sub