Results 1 to 7 of 7

Thread: Scroll text from right to left in a label or text box ?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2000

    Does anybody know how I can scroll a string in a single line of a Label or TextBox or StatusBar panel ?

    Thank you,

  2. #2
    In Textbox, you can control scrollbars with a property (scrollbars something). Just look at properties window at design time.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Mar 2000

    This is not what I want !

    In fact, I want it to scroll automatically and continously as a message.


  4. #4
    Ah...Then maybe the simplest way is to put autosized label in a picturebox with BorderStyle of 0. Then just with a timer you get a scroll in it easily.

    Dim lblLeft As Integer
    Private Sub Timer1_Timer()
        lblLeft = lblLeft - 15
        If lblLeft <= -Label1.Width Then lblLeft = Picture1.ScaleWidth
        Label1.Move lblLeft, 0
    End Sub

    Sorry, having a bad headache at the moment...Hope I got it right now.

  5. #5
    You can also try scrolling with textbox by changing it's SelStart value. It's not smooth if I remember right.

  6. #6
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999


    'scrolling text
    'need 1 label, 1 timer, 1 command button for this example
    Option Explicit
    Private Sub Command1_Click()
        'will give user a Yes or No prompt in which they wish to exit
            Dim x As Integer
            x = MsgBox("Are you sure you want to exit?", vbYesNo, "Exit")
            If x = 6 Then
            End If
        End Sub
    Private Sub Form_Load()
        'Will modify all the following controls when the project is run o
        '     r loaded
        dim msg$ as string
        msg$ = "This is a simple Marquee example that I've made." & vbCrLf
        msg$ = msg$ & "You can make something 100 times better."
        MsgBox msg$, vbYes, "Marquee Example of Scrolling Text"
        Label1.Visible = True
        Label1.Enabled = True
        Form1.Enabled = True
            Label1.Caption = Date
            Label1.Left = 0
            Label1.Top = 1800
            Label1.Height = 255
            Label1.Width = 1195
            Command1.Top = 2400
            Command1.Left = 0
            Command1.Height = 375
            Command1.Width = 6705
            Command1.Caption = "Exit Example"
            Command1.Enabled = True
            Command1.Visible = True
            Form1.Height = 3225
                Form1.Width = 6810
                    Timer1.Enabled = True
                    Timer1.Interval = 1
    End Sub
    Private Sub Timer1_Timer()
        If Label1.Left < -1000 Then
            Label1.Left = 7000
            Label1.Left = Val(Label1.Left) - 40
        End If
    End Sub
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Mar 2000

    Wink Thanks for all...

    Thanks for your replies.

    I used a Timer control as follow :

    Private Sub Timer_Timer()
    k = k + 1
    Label1.Caption = Left(lib, k)
    If k = Len(lib) Then k = 0
    End Sub

    And it works fine !...


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Click Here to Expand Forum to Full Width