• We just launched and are currently in beta. Join us as we build and grow the community.

Marquee Text in VB.NET

adrianfcdb

Responsive UI Specialist
A Rep
0
0
0
Rep
0
A Vouches
0
0
0
Vouches
0
Posts
39
Likes
191
Bits
2 MONTHS
2 2 MONTHS OF SERVICE
LEVEL 1 200 XP
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:

marqueedesign_0.png


3. Now put this code for your code module.
  1. Public

    Class

    Form1

  2. Private

    Sub

    Timer1_Tick(

    ByVal

    sender As

    System.

    Object

    , ByVal

    e As

    System.

    EventArgs

    )

    Handles

    Timer1.

    Tick
  3. Timer1.

    Interval

    =

    NumericUpDown1.

    Value
  4. Label1.

    Left

    =

    Label1.

    Left

    -

    10
  5. If

    Label1.

    Left

    <

    0

    -

    Label1.

    Width

    Then
  6. Label1.

    Left

    =

    Me

    .

    Width
  7. End

    If
  8. End

    Sub

  9. Private

    Sub

    Form1_Load(

    ByVal

    sender As

    System.

    Object

    , ByVal

    e As

    System.

    EventArgs

    )

    Handles

    MyBase

    .

    Load
  10. Timer1.

    Enabled

    =

    True
  11. End

    Sub
  12. 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:

marqueeoutput1.png


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


Download
You must upgrade your account or reply in the thread to view hidden text.
 

452,292

323,891

323,899

Top