Library code snippets
Scrolling Text
By James Crowley, published on 14 Jul 2001
For this example, add a Picture Box (named picHolder) and a Timer (named tmrScroll) to your form. Next, add a label called lblMsg within the Picture Box, and enter a few lines of text into its caption property. Then, add the code below, and run your project!
Private Sub Form_Load()
lblMsg.Top = picHolder.Height
tmrScroll.Interval = 10
tmrScroll.Enabled = True
End Sub
Private Sub tmrScroll_Timer()
If lblMsg.Top > -lblMsg.Height Then
lblMsg.Top = lblMsg.Top - 10
Else
lblMsg.Top = picHolder.Height
End If
End Sub
Related articles
Related discussion
-
Visual Studio: MDI Parent Form designer
by cutiegigshorty (0 replies)
-
Working on Who Wants To Be A Millionaire Project in VB6 [NEED HELP]
by candienne092 (2 replies)
-
Needs help with MSFlexGrid and MSAccess in VB6
by ClarkKentNeedsHelp (0 replies)
-
Make me or point me to an installer with comctl32 vb6
by tgkprog2 (0 replies)
-
How to use VB6 to make cumulative frequency polygons
by heibaidoufu (0 replies)
Here's a slightly better way:
Private Sub picHolder_Click
tmrScroll.Interval = tmrScroll.Interval XOR 10
end sub
This works because 10 XOR 10 = 0, and 0 XOR 10 = 10. You can use any number.
By adding a simple code, you can click to start, and click to stop the scrolling:
Private Sub picHolder_Click()
If tmrScroll.Interval = 0 Then
tmrScroll.Interval = 10
Else
tmrScroll.Interval = 0
End If
End Sub
-Gaz
This thread is for discussions of Scrolling Text.