Advertisement
TermSpar

Slightly advanced program (BenAndChris)

Sep 13th, 2015
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 1.91 KB | None | 0 0
  1. Form1 you need:
  2. -4 buttons
  3. -1 label
  4. -1 timer
  5. -Form1 must be 923x580
  6.  
  7. Form2 you need:
  8. -1 button
  9.  
  10. -----------------------------------------------------------------------------------------------------------------------------------
  11.  
  12. Public Class Form1
  13.  
  14.     Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
  15.         Label1.Text = Format(Now, "yyyy-MM-dd hh:mm:ss")
  16.     End Sub
  17.  
  18.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  19.         Timer1.Start()
  20.         Label1.Location = New Point(174, 21)
  21.     End Sub
  22.  
  23.     Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
  24.         Timer1.Stop()
  25.         Label1.Text = "Click a button"
  26.         Label1.Location = New Point(264, 22)
  27.     End Sub
  28.  
  29.     Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
  30.         Dim oForm As Form2
  31.         oForm = New Form2()
  32.         oForm.Show()
  33.         oForm = Nothing
  34.  
  35.     End Sub
  36.  
  37.     Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
  38.         Application.Exit()
  39.     End Sub
  40. End Class
  41. -----------------------------------------------------------------------------------------------------------------------------------
  42.  
  43. Public Class Form2
  44.  
  45.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  46.         Me.Close()
  47.     End Sub
  48.  
  49.     Private Sub Button1_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.MouseEnter
  50.         Button1.Text = "Are you sure you want to exit?"
  51.     End Sub
  52.  
  53.     Private Sub Button1_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.MouseLeave
  54.         Button1.Text = "Close this window"
  55.     End Sub
  56. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement