Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 443
  • Last Modified:

vb6 Timer controls + lblmarquee

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
dreammaster
Asked:
dreammaster
  • 3
1 Solution
 
hj2k3Commented:
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
 
hj2k3Commented:
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
 
hj2k3Commented:
sorry, replace all the lb(i) with lblmarquee(i). i was feeling lazy.
0
 
CleanupPingCommented:
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now