Click here to Skip to main content
16,004,647 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
When an RTB or Picturebox control .top reaches certain points (maybe it's the maximum .top of the form?). It is not moving anymore. I have a huge amount of text because of News scripts.

Another problem is, it is not that smooth when scrolling.

What I have tried:

This is my code using Timer (interval=1) control.

VB.NET
For i = 0 To 500 Step 50
     If trackBarSpeed.Value < 51 Then
        PictureBox1.Top = PictureBox1.Top + 1
     ElseIf trackBarSpeed.Value > 51 Then
        PictureBox1.Top = PictureBox1.Top - 1
     Else
        tmrScroll1.Stop()
     End If
Next


Do you have any better approach to this?

Thank you so much.
Posted
Updated 3-Sep-24 3:26am
v4

1 solution

Looking at your code, all I can see is that you move 50 the top of the control 11 pixels. You have a for loop that is stepping up by 50, so you might as well just have written this as for count = 0 to 10. This will run so quickly that the top will appear to move almost instantly. I know that this project[^] is written in C# but you should be able to harvest knowledge from it for your implementation.
 
Share this answer
 
Comments
Member 13049700 3-Sep-24 23:38pm    
Thanks Pete,

It is now scrolling smoothly. I have another problem though.
When RichTextBox1.Top reaches the value of -62768 it stopped moving.

Can you give me also an idea about timer control. Do VS have timer faster than that?
Thanks in advance.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900