Marquee Text in VB.NET

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: design 3. Now put this code for your code module.
  1. Public Class Form1
  2.  
  3.     Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
  4.         Timer1.Interval = NumericUpDown1.Value
  5.         Label1.Left = Label1.Left - 10
  6.         If Label1.Left < 0 - Label1.Width Then
  7.             Label1.Left = Me.Width
  8.         End If
  9.     End Sub
  10.  
  11.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  12.         Timer1.Enabled = True
  13.     End Sub
  14. 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.
  1.         Label1.Left = Label1.Left - 10
  2.         If Label1.Left < 0 - Label1.Width Then
  3.             Label1.Left = Me.Width
  4.         End If
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.

Output:

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

how to make marquee right to left

Scriptnya Bener2 Bermanfaat. Pas Sekali. Terima Kasih ya.

Add new comment