Auto Scroll text in a static label

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gobblegob
    New Member
    • Dec 2007
    • 133

    Auto Scroll text in a static label

    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:

    [CODE=vb] 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.Siz e = 13
    Label1.Font.Bol d = 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.Capt ion) >= 42 Then Label1.Caption = Right(Label1.Ca ption, 41)

    If s = Len(dta) Then
    Label1.Caption = ""
    s = 0
    End If
    End Sub[/CODE]

    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.
    Last edited by debasisdas; Mar 14 '08, 09:44 AM. Reason: added code=vb tags
Working...