Results 1 to 6 of 6

Thread: [RESOLVED] Need Help animated marquee text in a label not moving

  1. #1

    Thread Starter
    Member
    Join Date
    Apr 2013
    Posts
    40

    Resolved [RESOLVED] Need Help animated marquee text in a label not moving

    hi i think something wrong in the code i got this in one of the suggestion here and i tried... i dont really have any knowledge in making a animated marquee text when i test this code and run this, the text in the label is not moving going to left.... i need this to be part of my announcement in my number system project...
    here is the code

    Code:
    Option Explicit
    
    Private Sub Form_Load()
        lblannounce.Caption = "Hello World. I am a not moving. help."
        lblannounce.Alignment = vbRightJustify
        Me.Font = lblannounce.Font
        lblannounce.Width = Me.TextWidth(lblannounce.Caption) + 30
        Timer1.Interval = 100
    End Sub
    
    Private Sub Timer1_Timer()
    Static i As Integer
        i = i + 1
        If i = Len(lblannounce.Caption) + 1 Then
            i = 1
                lblannounce.Caption = VBA.Left$(lblannounce.Caption, i)
        End If
    End Sub
    than for the help...

  2. #2
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: Need Help animated marquee text in a label not moving

    Is this what you want?

    vb Code:
    1. Option Explicit
    2.  
    3. Private Sub Form_Load()
    4.     lblannounce.Caption = "Hello World. I am a not moving. help."
    5.     lblannounce.Alignment = vbRightJustify
    6.     lblannounce.Width = Me.TextWidth(lblannounce.Caption) + 30
    7.     Timer1.Interval = 100
    8. End Sub
    9.  
    10. Private Sub Timer1_Timer()
    11.   If Timer1.Interval = 100 Then
    12.      lblannounce.Move lblannounce.Left - 100
    13.   End If
    14. End Sub
    Last edited by Nightwalker83; May 10th, 2013 at 06:48 AM. Reason: Fixed code!
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  3. #3
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    9,622

    Re: Need Help animated marquee text in a label not moving

    Add these two lines before your 'end if' and your marquee will continue to run over and over:

    If lblannounce.Left + lblannounce.Width < 0 Then
    lblannounce.Left = Me.Width

  4. #4
    New Member
    Join Date
    May 2013
    Posts
    8

    Re: Need Help animated marquee text in a label not moving

    Private Sub tmrTest_Timer()
    If tmrTest.Interval = 100 Then
    lblCaption.Move lblCaption.Left + 100
    If lblCaption.Left + lblCaption.Width < 0 Then
    lblCaption.Left = Me.Width
    End If
    End Sub

    pls is showing me compiler error

  5. #5
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    9,622

    Re: Need Help animated marquee text in a label not moving

    nwagboso...please start your own thread.
    And in that thread,, state what the compiler error is....probably your naming of the timer or the label.
    And, the interval (you set at 100 --- over and over ) doesn't make sense...nor does the "+" vice a "-" in your third line...
    SO, start a new thread, new title, and someone will assist.

  6. #6

    Thread Starter
    Member
    Join Date
    Apr 2013
    Posts
    40

    Re: Need Help animated marquee text in a label not moving

    its working here is what i did

    Code:
    Private Sub Form_Load()
        lblannounce.Caption = "My Mesage Here"
        Timer2.Enabled = True
        Timer2.Interval = 300
    End Sub
    
    Private Sub Timer2_Timer()
    Dim str As String
        str = frmnumber.lblannounce.Caption
        str = Mid$(str, 2, Len(str)) + Left(str, 1)
        frmnumber.lblannounce.Caption = str
    End Sub
    thanks for the help....

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