Results 1 to 7 of 7

Thread: Quick & Easy StatusBar Question

  1. #1

    Thread Starter
    Lively Member milkmood's Avatar
    Join Date
    Mar 2005
    Location
    Forests of Delta Halo
    Posts
    109

    Question Quick & Easy StatusBar Question

    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

  2. #2
    Frenzied Member tr333's Avatar
    Join Date
    Nov 2004
    Location
    /dev/st0
    Posts
    1,605

    Re: Quick & Easy StatusBar Question

    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:
    1. Static counter as Integer
    2.  
    3. If counter = 1 Then
    4.     Timer1.Stop
    5.     counter = 0
    6.     StatusBar1.Text = String.Empty
    7. Else
    8.     counter += 1
    9.     StatusBar1.Text = "your text here"
    10. End If

    EDIT: don't forget to set the timer interval to the required value.
    CSS layout comes in to the 21st century with flexbox!
    Just another Perl hacker,

  3. #3

    Thread Starter
    Lively Member milkmood's Avatar
    Join Date
    Mar 2005
    Location
    Forests of Delta Halo
    Posts
    109

    Re: Quick & Easy StatusBar Question

    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

  4. #4
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Quick & Easy StatusBar Question

    Just enable your timer in the click event of the delete button. Then when the ime has elapsed you disable your timer.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  5. #5

    Thread Starter
    Lively Member milkmood's Avatar
    Join Date
    Mar 2005
    Location
    Forests of Delta Halo
    Posts
    109

    Re: Quick & Easy StatusBar Question

    <kip>That sounds pretty good.</kip>
    <lloyd>That sounds good, I'll try that</lloyd>

  6. #6

    Thread Starter
    Lively Member milkmood's Avatar
    Join Date
    Mar 2005
    Location
    Forests of Delta Halo
    Posts
    109

    Re: Quick & Easy StatusBar Question

    More info Rob ? Syntax?

  7. #7
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Quick & Easy StatusBar Question

    Add a timer control to your form and add some code something like so.
    VB Code:
    1. Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    2.     Me.Timer1.Enabled = False
    3.     Me.Timer1.Interval = 5000 'Miliseconds
    4. End Sub
    5.  
    6. Private Sub tmrTimer_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles tmrTimer.Tick
    7.     Me.StatusBarDescription.Text = String.Empty
    8.     Me.Timer1.Enabled = False
    9. End Sub
    10.  
    11. Public Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    12.     Me.StatusBarDescription.Text = "Processing Update..."
    13.     Application.DoEvents()
    14.     Me.Timer1.Enabled = True
    15.     'Do your update stuff
    16.     '...
    17.     '...
    18. End Sub
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width