Text Scrolling Up Effect using VB.NET
In this article, we will create a program that has an effect of scrolling up the text.
Now, let's start this tutorial!
1. Let's start with creating a Windows Form Application for this tutorial by following the following steps in Microsoft Visual Studio: Go to File, click New Project, and choose Windows Application.
2. Next, add only one Label named Label1 and labeled it as any text. Add a timer control named Timer1 and have its interval of 30. You must design your interface like this:
3. Now put this code for your code module. This code is for Timer1_Tick and it will have to be enabled in the Form_Load:
- Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
- If Label1.Top = -Label1.Height Then
- Label1.Top = Label1.Height
- Label1.Top = Label1.Top - 1
- End If
- End Sub
- Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
- Timer1.Enabled = True
- End Sub
We have created a code for Timer1 when ticking its clock or starting its time. This event occurs when the specified timer interval has elapsed and the timer is enabled. We have created an If Else statement for the top and height of the Label. If the top will be equal to the negative of its height then it will be equal on both positive location of the top and its height. Meaning to say, after it will going up and bounds with the form, it will back to its original place and will scroll up again. If not yet, then the label top position will be decremented by 1. Why it must be decremented? Because minimizing or lowering the value of the top position will have a greater top position. When it will be incremented, then it will scroll down at the bottom. Then, in loading the form, we just have enabled the time do that the first run of the program it will scroll up the text in our label.
Download the source code below and try it! :)
For more inquiries and need programmer for your thesis systems in any kind of programming languages, just contact my number below.
Engr. Lyndon Bermoy
IT Instructor/System Developer/Android Developer/Freelance Programmer
Add and Follow me on Facebook: https://www.facebook.com/donzzsky
Visit and like my page on Facebook at: https://www.facebook.com/BermzISware