Solved

String scrolling

Posted on 2001-08-05
6
148 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 50 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
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!

 
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

Ready to get started with anonymous questions?

It's easy! Check out this step-by-step guide for asking an anonymous question on Experts Exchange.

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
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 Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses
Course of the Month5 days, 11 hours left to enroll

627 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