How to Auto Scroll Text in a Textbox Using VB.NET

Updated July 20, 2017

Creating a Visual Basic.NET application that auto scrolls text in a TextBox control can easily be accomplished using String arrays and a timer. A timer control in VB.NET will execute code continuously until the program ends. Use a String array to fill it with the text you want to scroll, and display different elements of the array in the TextBox using the timer to show the scrolling effect.

Launch Microsoft Visual Studio, click "New Project" from the left pane of your computer screen and expand "Visual Basic" below "Installed Templates." Click "Windows" and double-click "Windows Forms Application" from the centre of the dialogue window to create a new project.

Double-click "Timer" to add one to your form. Double-click "TextBox" to add a new text box to your form. Double-click the form to create a form load event.

Add the following code above the form load event to create three global variables, including the one that will hold your scrolling text:

Dim scrolling Text As String = "This is my scrolling text "

Add the following code inside the form load event to loop through the scrolling text and start the timer:

Switch back to form design view and double-click "Timer1" to create a tick event for the timer. Add the following code inside the event:

Press "F5" to run the program and display scrolling text using the text box.

Cite this Article A tool to create a citation to reference this article Cite this Article

About the Author

Jaime Avelar is a professional writer whose programming articles appear on various websites. He has been a software programmer since 2000. Avelar holds a Master of Science in information systems from the University of Texas at Arlington.