?
Solved

vb6 Timer controls +  lblmarquee

Posted on 2003-03-09
5
Medium Priority
?
440 Views
Last Modified: 2012-06-21
Can anyone help , as one would like to display to different moving texts using marquee using one timer for two lblmarquees. And one has no clue how this is done.

Here is the lblmarquee code for 1 timer control :

private sub form_load

inview=1
StrCaption="Nice To See You Again       Nice To See You Again  "

End Sub

private sub Timer1_Timer()

lblmarquee.Caption=MID(StrCaption,intview,21)

intview=intview+1
IF Intview = 31 THEN intview = 1

End Sub

private sub form _load

intview=1
StrCaption="Have A Nice Day          Have A Nice Day  "

End Sub

private Sub Timer1_Timer()
lblmarquee.caption=MID(CstrCaption,Intview,21)

intview=intview + 1

If intview = 31 Then intview = 1
End Sub



One would like to use a second lblmarquee but one needs to use one timer control for both lblmarquee's

Can anyone please show me how this is done ?

Thank You
0
Comment
Question by:dreammaster
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 1

Expert Comment

by:hj2k3
ID: 8098772
put the labels in a control array. just create a second label called lblmarquee and it will ask you if you want to create a control array. click yes, then put this in the timer code:

private sub Timer1_Timer()
Dim i As Integer
For i = 0 To lb.UBound
  lblmarquee(i).Caption = Right(lblmarquee(i), 1) + Left(lblmarquee(i), Len(lblmarquee(i)) - 1)
Next i

end sub

this way, you can have as many marquees as you like with one timer

hope this helps
0
 
LVL 1

Accepted Solution

by:
hj2k3 earned 400 total points
ID: 8098794
p.s if you want it to go backwards, use this instead:

Private Sub Timer1_Timer()
Dim i As Integer
For i = 0 To lb.UBound
  lb(i).Caption = Right(lb(i), Len(lb(i)) - 1) + Left(lb(i), 1)
Next i

End Sub

it does a marquee effect on whatever is in the caption at the time, so changing it in-between timer events is also possible without worrying about changing anything other than the caption itself

p.p.s if you want it to look a bit smoother, use a monospaced font like Courier New or Terminal
0
 
LVL 1

Expert Comment

by:hj2k3
ID: 8098809
sorry, replace all the lb(i) with lblmarquee(i). i was feeling lazy.
0
 

Expert Comment

by:CleanupPing
ID: 9447245
dreammaster:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
In this post we will learn different types of Android Layout and some basics of an Android App.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Suggested Courses
Course of the Month8 days, 12 hours left to enroll

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question