README.md
December 4, 2022 ยท View on GitHub
Description
Beginner level discussion on proper use of the Timer Control. Give your About Box a bit of sex appeal.
More Info
| Submitted On | |
| By | Ross Ylitalo |
| Level | Beginner |
| User Rating | 5.0 (10 globes from 2 users) |
| Compatibility | VB 6.0 |
| Category | Coding Standards |
| World | Visual Basic |
| Archive File |
Source Code
Private m_strFullCaption As String
Private m_strCurrentCaption As String
Private m_ynLeftRight As Boolean
Private Sub Form_Load()
m_strFullCaption = Me.Caption ' Don't mutate m_strFullCaption after this!
Me.Caption = ""
m_strCurrentCaption = ""
m_ynLeftRight = True
End Sub
Private Sub tmr_Timer()
If m_ynLeftRight Then
' Show caption from left to right.
If Len(m_strCurrentCaption) < Len(m_strFullCaption) Then
m_strCurrentCaption = Left(m_strFullCaption, Len(m_strCurrentCaption) + 1)
Me.Caption = m_strCurrentCaption
Else
m_ynLeftRight = Not m_ynLeftRight
End If
Else
' Scroll caption off of screen, scrolling Left.
If Len(m_strCurrentCaption) > 0 Then
m_strCurrentCaption = Right(m_strFullCaption, Len(m_strCurrentCaption) - 1)
Me.Caption = m_strCurrentCaption
Else
m_ynLeftRight = Not m_ynLeftRight
End If
End If
End Sub