Skip to main content

Write a VB program to create screen saver on the form.

· One min read
Kaustubh Kulkarni
file.vb
 Dim n As Integer  
Private Sub Form_Load()
Label1.Top = Me.Height / 2
Label1.Left = Me.Width
Timer1.Interval = 1
Timer1.Enabled = True

End Sub
Private Sub Timer1_Timer()

If n < 200 Then
n = n + 1
Label1.Left = Label1.Left + Val(10)
ElseIf n < 400 Then
n = n + 1
Label1.Left = Label1.Left - Val(10)
Else
n = 0
End If
End Sub