|
-
May 10th, 2013, 01:34 AM
#1
Thread Starter
Member
[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...
-
May 10th, 2013, 03:54 AM
#2
Re: Need Help animated marquee text in a label not moving
Is this what you want?
vb Code:
Option Explicit Private Sub Form_Load() lblannounce.Caption = "Hello World. I am a not moving. help." lblannounce.Alignment = vbRightJustify lblannounce.Width = Me.TextWidth(lblannounce.Caption) + 30 Timer1.Interval = 100 End Sub Private Sub Timer1_Timer() If Timer1.Interval = 100 Then lblannounce.Move lblannounce.Left - 100 End If 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
-
May 10th, 2013, 06:55 AM
#3
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
-
May 10th, 2013, 09:58 AM
#4
New Member
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
-
May 10th, 2013, 10:08 AM
#5
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.
-
May 14th, 2013, 03:30 AM
#6
Thread Starter
Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|