Fun

Fun
Want to Play!

Friday, March 25, 2011

Button hover

 Public Class Form1
  
   Dim pt1 As New Point(100, 35)
  
   Dim pt2 As New Point(45, 500)
  
   Dim pt3 As New Point(354, 99)
  
   Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
  
     MessageBox.Show("You shot me", "Why would you shoot me?!?", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
  
   End Sub
  
   Private Sub Button1_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.MouseEnter
  
     If Button1.Location = pt1 Then
  
       Button1.Location = pt2
  
     ElseIf Button1.Location = pt2 Then
  
       Button1.Location = pt3
  
     ElseIf Button1.Location = pt3 Then
  
       Button1.Location = pt1
  
     End If
  
   End Sub
  
   Private Sub Button1_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.MouseHover
  
   End Sub
  
   Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  
     Button1.Location = pt1
  
   End Sub
  
 End Class
  

Sunday, March 20, 2011

Example loops

Example on For loop

 Module1


Sub Main()
Dim d As Integer
For d = 0 To 2
System.Console.WriteLine("In the For Loop")
Next d
End Sub


Example on Do loop


Module Module1


Sub Main()
Dim str As String
Do Until str = "Cool"
System.Console.WriteLine("What to do?")
str = System.Console.ReadLine()
Loop
End Sub


Example on While loop


Module Module1


Sub Main()
Dim d, e As Integer
d = 0
e = 6
While e > 4
e -= 1
d += 1
End While
System.Console.WriteLine("The Loop ran " & e & "times")
End Sub