User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Visual Basic 4 / 5 / 6 section within the Software Development category of DaniWeb, a massive community of 373,565 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,859 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Visual Basic 4 / 5 / 6 advertiser:
Jul 11th, 2005
Views: 6,451
Easily allows temporary message to be displayed on any label for a programmable length of time.
This is a very simple way to display a temporary message on an existing label (or textbox)without doing a lot of coding.
visualbasic Syntax
  1. Private Function TempMsg(tempMessage As String, timeInSecs As Single, whichLabel As Object)
  2. ' ========================
  3. ' Author: CookWare Ok
  4. ' ========================
  5. ' Function may be Public or Private as needed. Remember if used in a module use
  6. ' WhichForm.WhichLabel format to pass parameter to the function.
  7. ' EXAMPLE: Call TempMsg(myMessage, myTime, myForm.myLabel)
  8. ' ========================
  9. ' You Must included timer and timer code shown below
  10. ' ========================
  11. ' Private Sub timMsg_Timer()
  12. ' timMsg.Interval = 0
  13. ' timMsg.Enabled = False
  14. ' bMsgOn = False
  15. ' End Sub
  16. ' ========================
  17. ' You must also Dim bMsgOn As Boolean (either Public or Private as needed)
  18. ' =======================
  19. Dim myMsg As String
  20. myMsg = whichLabel ' Stores currently displayed message
  21. bMsgOn = True
  22. If timeInSecs > 10 Then ' Limits time interval to 10 seconds ( May be changed as you see fit )
  23. timeInSecs = 10
  24. End If
  25. timMsg.Interval = timeInSecs * 1000 ' converts timeInSecs to milliseconds
  26. timMsg.Enabled = True ' Starts timer
  27. Do Until bMsgOn = False ' Do tempMessage until time is elapsed
  28. DoEvents
  29. whichLabel = tempMessage
  30. Loop
  31. whichLabel = myMsg ' Restores original message
  32. End Function
  33.  
Comments (Newest First)
linux | Posting Shark | Feb 8th, 2007
It's not that difficult to read. You don't really need the comments if you know what you're doing in VB.
bumsfeld | Posting Shark | Aug 8th, 2005
Wow, this difficult to read! Why are there so many "you must" in there?
Post Comment

Only community members can submit or comment on code snippets. You must register or log in to contribute.

DaniWeb Marketplace (Sponsored Links)
All times are GMT -4. The time now is 7:34 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC