Contohnya :
Public Class Form1
Dim d As Integer = 0
Dim a As Button
Dim b As Point
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If d = 0 Then
b = Button1.Location
d = 1
a = Button1
Else
a.Location = Button1.Location
Button1.Location = b
d = 0
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
If d = 0 Then
b = Button2.Location
d = 1
a = Button2
Else
a.Location = Button2.Location
Button2.Location = b
d = 0
End If
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
If d = 0 Then
b = Button3.Location
d = 1
a = Button3
Else
a.Location = Button3.Location
Button3.Location = b
d = 0
End If
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
If d = 0 Then
b = Button4.Location
d = 1
a = Button4
Else
a.Location = Button4.Location
Button4.Location = b
d = 0
End If
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
If d = 0 Then
b = Button5.Location
d = 1
a = Button5
Else
a.Location = Button5.Location
Button5.Location = b
d = 0
End If
End Sub
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
If d = 0 Then
b = Button6.Location
d = 1
a = Button6
Else
a.Location = Button6.Location
Button6.Location = b
d = 0
End If
End Sub
Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
If d = 0 Then
b = Button7.Location
d = 1
a = Button7
Else
a.Location = Button7.Location
Button7.Location = b
d = 0
End If
End Sub
Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
If d = 0 Then
b = Button8.Location
d = 1
a = Button8
Else
a.Location = Button8.Location
Button8.Location = b
d = 0
End If
End Sub
Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
If d = 0 Then
b = Button9.Location
d = 1
a = Button9
Else
a.Location = Button9.Location
Button9.Location = b
d = 0
End If
End Sub
End Class
Tidak ada komentar:
Posting Komentar