Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

scrolling label bar 2

Status
Not open for further replies.

M626

Programmer
Mar 13, 2002
299
I have a label bar that looks at all files in a folder and scrolls all the file names through a label. My problem is that when i add files it seems to skip every other or sometime s it only should 2 our of the 5 in the folder.

Here is my code if anyone can help me figure this one out.

Private Sub Timer1_Timer()
Static Count As Integer
Dim FS As New FileSystemObject
Dim FSfolder As Folder
Dim File As File
Dim i As Integer
Dim aryTemp() As String


Set FSfolder = FS.GetFolder(CurDir & "\Files")
For Each File In FSfolder.Files
DoEvents
aryTemp = Split(File, "\")


'######################
'When the label goes off the left side of the form,
' reposition it onto the right side.
If (lblMarquee.Left + lblMarquee.Width) <= 0 Then
lblMarquee.Left = Form1.Width

'lblMarquee = ""

lblMarquee = aryTemp(UBound(aryTemp))
Count = Count + 1
End If

lblMarquee.Left = lblMarquee.Left - 100


'########################

Next File
Set FSfolder = Nothing


End Sub
 
Take a look at this;
thread222-1223975
and the original
thread222-531427
 
That works but the problem is that i can't read in the string from a file one line at at time.

I have narrowed the problem to this part of my code.

It loops and because of the time it takes for the text to scroll off, it only toggles between two of the lines as it continously reading the text file. Is there a way i can not allow the reading of the lines in the file until the previous text has scrolled off the form?

Do While tStreamIn.AtEndOfStream <> True ' Loop through each line
'lblMarquee = ""
sBuffer = tStreamIn.ReadLine

'######################
'When the label goes off the left side of the form,
' reposition it onto the right side.
If (lblMarquee.Left + lblMarquee.Width) <= 0 Then
lblMarquee.Left = Form1.Width


sBuffer = Trim$(sBuffer)
lblMarquee = sBuffer

'lblMarquee = aryTemp(UBound(aryTemp))
'Text1 = Text1 & vbCrLf '& aryTemp(UBound(aryTemp))
Count = Count + 1
End If

lblMarquee.Left = lblMarquee.Left - 100

Loop
'#
 
Ok... If i just do the tStreamIn.Readline within my if statement to test if the previous text has scrolled out of the form, it works but it is moving way to fast.

How do i show down the scrolling?

If (lblMarquee.Left + lblMarquee.Width) <= 0 Then
lblMarquee.Left = Form1.Width

sBuffer = tStreamIn.ReadLine

sBuffer = Trim$(sBuffer)
lblMarquee = sBuffer

'lblMarquee = aryTemp(UBound(aryTemp))
'Text1 = Text1 & vbCrLf '& aryTemp(UBound(aryTemp))
Count = Count + 1
End If

lblMarquee.Left = lblMarquee.Left - 100

Loop
 
The scrolling is caused by moving the label in a loop. Therefore either slow down the loop or make the move for each pass round the loop smaller.

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
 
to slow down - use the timer, call "scroll by 1 letter" thing from timer event.
Or you can use sleep API call - but then you program will sleep (do nothing) between scrolls.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top