Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

String scrolling

Posted on 2001-08-05
6
Medium Priority
?
152 Views
Last Modified: 2010-05-02
I'm building an MP3-Player and a CD-Player, now I'm getting the MP3-filename (Songtitle) to scroll on a label.
The problem I would like to solve is: there is a flikkering of the text and the spaces take more time than the actual characters, does anybody know how to get a smooth scroll without these glitches?

This is how I do it:

Private Sub cmdScroll_Click()
lblScroll.Caption = "                        " & txtInput.Text
tmrScrollNow.Interval = 75

End Sub



Private Sub tmrScrollNow_Timer()
   Dim strInputText As String
   Dim i As Integer
   Dim strFirstletter As String
   Dim strTextMinusFirst
   Dim bytLengte As Byte
   Dim strToScroll As String
     
     
 On Error Resume Next
      strInputText = lblScroll.Caption
      bytLengte = Len(strInputText)
      strFirstletter = Left(strInputText, 1)
   strTextMinusFirst = Right(strInputText, (bytLengte -1))
      strToScroll = strTextMinusFirst & strFirstletter
      lblScroll.Caption = strToScroll
      strInputText = strToScroll
 
End Sub


0
Comment
Question by:HeN_da_MaN
[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
6 Comments
 
LVL 22

Accepted Solution

by:
CJ_S earned 150 total points
ID: 6353018
Best way to get that done is by using a frame. The clipcontrols property of that frame should be set to true. Now in that frame you put a label. You put the text in that label, and then  you decrement or increment the left property of that label. You can use a timer for that.

it would be something like:

Private Sub Timer1_Timer()
   Label1.Left = Label1.Left - 1
   If((Label1.Left + Label1.Width)<0) Then Label1.Left = Frame1.Width
End Sub

Regards,
CJ
0
 
LVL 3

Expert Comment

by:Bahnass
ID: 6353043

How about putting a label on a picture box
then moving it
like that


Hi HeN_da_MaN

Private Sub Command1_Click()
lblScroll.Caption = "                        " & txtInput.Text
tmrScrollNow.Interval = 5

End Sub

Private Sub tmrScrollNow_Timer()
  Dim strInputText As String
  Dim i As Integer
  Dim strFirstletter As String
  Dim strTextMinusFirst
  Dim bytLengte As Byte
  Dim strToScroll As String
     
     
On Error Resume Next
 lblScroll.Left = lblScroll.Left - 2
 If lblScroll.Left = -lblScroll.Width Then lblScroll.Left = 0
 
End Sub
yours

0
 
LVL 3

Expert Comment

by:Bahnass
ID: 6353044
Sorry C_J
I did not updated
U R too fast
0
Independent Software Vendors: 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!

 
LVL 3

Expert Comment

by:andysalih
ID: 6353569
what about doing it like this

Public Str As String
Private Sub Form_Load()
Caption = ""

Timer1.Interval = 200
Str = "Hello, World! "
End Sub

Private Sub Timer1_Timer()
Static x As Integer
If x < Len(Str) Then
x = x + 1
Caption = Caption & Mid(Str, x, 1)
Else    
x = 0
Caption = "" 
End If
End Sub


cheers

hope this helps
andy
0
 
LVL 4

Expert Comment

by:wileecoy
ID: 6353756
HeN_da_MaN

I use your code and it works just fine for me.  No blinking and spaces take the same amount of time as all other numbers & letters.

0
 

Author Comment

by:HeN_da_MaN
ID: 6358227
Thank you,

Hen
0

Featured Post

Enroll in September's Course of the Month

This month’s featured course covers 16 hours of training in installation, management, and deployment of VMware vSphere virtualization environments. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

670 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