Marquee Text in VB.NET
Submitted by donbermoy on Tuesday, April 1, 2014 - 00:53.
In HTML, a marquee is a small section of the browser window that displays text that rolls across the screen. You use the MARQUEE element to create scrolling section. Here in this article, we will also create a marquee function using vb.net.
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 Timer named Timer1, Label named Label1 and NumericUpDown control named NumericUpdown1. You must design your interface like this:
3. Now put this code for your code module.
Left properties here is for horizontal location. When the timer starts to tick, the label moved its location by decrementing by 10. If the label's left property is change to 0 then it will be equal to the with of the form making it to scroll again to the left.
- Public Class Form1
- Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
- Timer1.Interval = NumericUpDown1.Value
- Label1.Left = Label1.Left - 10
- If Label1.Left < 0 - Label1.Width Then
- Label1.Left = Me.Width
- 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
- End Class
Explanation:
We used Timer1 as a control to make the text moved with regards to the time as it ticks. The time interval of our timer1 is to be equal to the value inputted in NumericUpDown1. With the use NumericUpDown1, it can adjust the speed of the marquee text. Then the code below is used for moving text from right to left.- Label1.Left = Label1.Left - 10
- If Label1.Left < 0 - Label1.Width Then
- Label1.Left = Me.Width
- End If
Output:
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 R. Bermoy
IT Instructor/System Developer/Android Developer
Mobile: 09079373999
Telephone: 826-9296
E-mail:[email protected]
Visit and like my page on Facebook at: Bermz ISware Solutions
Subscribe at my YouTube Channel at: SerBermz
Comments
Add new comment
- Add new comment
- 2240 views