Program 3 Write a Vb.Net program to move the Text “Dr D Y Patil College” continuously from Left to Right.

Program 3 Write a Vb.Net program to move the Text “Dr D Y Patil College” continuously from Left to Right.
Solution:-
Step 1. Add Windows Form with Name P3.vb
Step 2. Drag and dropLable control from Toolbox on the form set property Name = lblMessage
Step 3. Double click on blank area of form to add page load event
Step 4. Add Timer control on the form Double click on the Timer1 control to add tick event
Step 6. Insert following code in the program
Public Class P3
    Dim x, y As Integer
    Private Sub P3_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        x = 0
        y = 100
        Timer1.Enabled = True
        Timer1.Start()
    End Sub
    Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
        x += 5
        If x >= Me.Size.Width Then
            x = 0
        End If
        lblMessage.Location = New Drawing.Point(x, y)
    End Sub
End Class

No comments:

Post a Comment