Library code snippets
Scrolling Text
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
-
Run-time error '91'
by converter2009 (1 replies)
-
VB6 Runtime error 381 subsript out of range Error
by Uncle (2 replies)
-
passing and reading parameters from using Shell
by jigartoliya (0 replies)
-
Convert C++ code to VB6
by mawcot (4 replies)
-
listbox scrollbar
by Dennijr (10 replies)
Related podcasts
-
Christian Beauclair
14 mai 2008 (�mission #0074) ::.Christian Beauclair: Stratégies de migration VB6 vers .NET Nous discutons avec Christian Beauclair des stratégies de migration VB6 vers .NET. Entre autres, nous discutons comment utiliser le "VB 6 Code Advisor" et le "Interop Forms Toolkit" pour ajouter la puiss...
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.