Well i cannont remember where i picked this code up, but i have seen
it asked for in many forums, Many times so i thought i'd add it here (Since this is my favourite forum).
Auto scroll text in a static label.
To your Form...
Add 1 label
Add 1 command Button
Add 1 Timer
Add 1 Textbox
Code: ( vb 6 )
DECLARATIONS:
- Dim s As Integer
-
Dim dta As String
-
-
-
Private Sub Command1_Click()
-
Label1.Caption = ""
-
Timer1.Enabled = True
-
Timer1.Interval = 100
-
Label1.Width = 4335
-
Label1.Font = "Palatino Linotype"
-
Label1.Font.Size = 13
-
Label1.Font.Bold = False
-
End Sub
-
-
Private Sub Timer1_Timer()
-
-
' put your text here in dta string
-
dta = "Whatever text you want to scroll" & Space$(40)
-
s = s + 1
-
Label1.Caption = Mid(dta, 1, s)
-
If Len(Label1.Caption) >= 42 Then Label1.Caption = Right(Label1.Caption, 41)
-
-
If s = Len(dta) Then
-
Label1.Caption = ""
-
s = 0
-
End If
-
End Sub
It is very self explanatory very easy to use just cut & paste code , and then add command button, timer and label.
Hope this helps , if you like this i have 85 more basic / very usefull how to's ready to use code samples.
GobbleGob.
Thanks for reading.