You are on page 1of 6

Belinda Hu Shin Yi 790227-13-5276 – BIS

VP group assignment coding

Start
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Me.Hide()
Match1.Show()
End Sub

Match1
Public Class Match1
Dim bln1, bln2, bln3, bln4 As Boolean

Private Sub Form2_Load(sender As Object, e As EventArgs) Handles MyBase.Load

PictureBox5.AllowDrop = True
PictureBox6.AllowDrop = True
PictureBox7.AllowDrop = True
PictureBox8.AllowDrop = True
bln1 = False
bln2 = False
bln3 = False
bln4 = False
Label7.Text = Score
End Sub
Private Sub PictureBox1_Mousedown(sender As Object, e As MouseEventArgs) Handles
PictureBox1.MouseDown
bln1 = True
bln2 = False
bln3 = False
bln4 = False
PictureBox1.DoDragDrop(PictureBox1.Image, DragDropEffects.All)

End Sub
Private Sub PictureBox2_Mousedown(sender As Object, e As MouseEventArgs) Handles
PictureBox2.MouseDown
bln2 = True
bln1 = False
bln3 = False
bln4 = False
PictureBox2.DoDragDrop(PictureBox2.Image, DragDropEffects.All)

End Sub
Private Sub PictureBox3_Mousedown(sender As Object, e As MouseEventArgs) Handles
PictureBox3.MouseDown
bln3 = True
bln1 = False
bln2 = False
bln4 = False
PictureBox3.DoDragDrop(PictureBox3.Image, DragDropEffects.All)

End Sub
Private Sub PictureBox4_Mousedown(sender As Object, e As MouseEventArgs) Handles
PictureBox4.MouseDown
bln4 = True
bln1 = False
bln2 = False
bln3 = False
PictureBox4.DoDragDrop(PictureBox4.Image, DragDropEffects.All)
End Sub
Private Sub PictureBox5_Dragenter(sender As Object, e As DragEventArgs) Handles
PictureBox5.DragEnter
If e.Data.GetDataPresent(DataFormats.Bitmap) Then
e.Effect = DragDropEffects.Copy
Else
e.Effect = DragDropEffects.None
End If

End Sub
Private Sub PictureBox6_Dragenter(sender As Object, e As DragEventArgs) Handles
PictureBox6.DragEnter
If e.Data.GetDataPresent(DataFormats.Bitmap) Then
e.Effect = DragDropEffects.Copy
Else
e.Effect = DragDropEffects.None
End If
End Sub
Private Sub PictureBox7_Dragenter(sender As Object, e As DragEventArgs) Handles
PictureBox7.DragEnter
If e.Data.GetDataPresent(DataFormats.Bitmap) Then
e.Effect = DragDropEffects.Copy
Else
e.Effect = DragDropEffects.None
End If
End Sub
Private Sub PictureBox8_Dragenter(sender As Object, e As DragEventArgs) Handles
PictureBox8.DragEnter
If e.Data.GetDataPresent(DataFormats.Bitmap) Then
e.Effect = DragDropEffects.Copy
Else
e.Effect = DragDropEffects.None
End If
End Sub
Private Sub PictureBox5_Dragdrop(sender As Object, e As DragEventArgs) Handles
PictureBox5.DragDrop
Me.PictureBox5.Image = CType(e.Data.GetData(DataFormats.Bitmap), Bitmap)
If bln3 = True Then
Score += 3
Label7.Text = Score
Else MsgBox("Try again")
End If

End Sub
Private Sub PictureBox6_Dragdrop(sender As Object, e As DragEventArgs) Handles
PictureBox6.DragDrop
Me.PictureBox6.Image = CType(e.Data.GetData(DataFormats.Bitmap), Bitmap)
If bln1 = True Then
Score += 3
Label7.Text = Score
Else MsgBox("Try again")
End If

End Sub
Private Sub PictureBox7_Dragdrop(sender As Object, e As DragEventArgs) Handles
PictureBox7.DragDrop
Me.PictureBox7.Image = CType(e.Data.GetData(DataFormats.Bitmap), Bitmap)
If bln4 = True Then
Score += 3
Label7.Text = Score
Else MsgBox("Try again")
End If
End Sub
Private Sub PictureBox8_Dragdrop(sender As Object, e As DragEventArgs) Handles
PictureBox8.DragDrop
Me.PictureBox8.Image = CType(e.Data.GetData(DataFormats.Bitmap), Bitmap)
If bln2 = True Then
Score += 3
Label7.Text = Score
Else MsgBox("Try again")
End If
End Sub

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click


Match2.Label7.Text = Score
Me.Close()
Match2.Show()
End Sub
End Class

Match2
Public Class Match2
Dim bln1, bln2, bln3, bln4 As Boolean
Private Sub Form3_load(sender As Object, e As EventArgs) Handles MyBase.Load

PictureBox5.AllowDrop = True
PictureBox6.AllowDrop = True
PictureBox7.AllowDrop = True
PictureBox8.AllowDrop = True
bln1 = False
bln2 = False
bln3 = False
bln4 = False
Label7.Text = Score
End Sub
Private Sub PictureBox1_Mousedown(sender As Object, e As MouseEventArgs) Handles
PictureBox1.MouseDown
bln1 = True
bln2 = False
bln3 = False
bln4 = False
PictureBox1.DoDragDrop(PictureBox1.Image, DragDropEffects.All)
End Sub
Private Sub PictureBox2_Mousedown(sender As Object, e As MouseEventArgs) Handles
PictureBox2.MouseDown
bln2 = True
bln1 = False
bln3 = False
bln4 = False
PictureBox2.DoDragDrop(PictureBox2.Image, DragDropEffects.All)
End Sub
Private Sub PictureBox3_Mousedown(sender As Object, e As MouseEventArgs) Handles
PictureBox3.MouseDown
bln3 = True
bln1 = False
bln2 = False
bln4 = False
PictureBox3.DoDragDrop(PictureBox3.Image, DragDropEffects.All)
End Sub
Private Sub PictureBox4_Mousedown(sender As Object, e As MouseEventArgs) Handles
PictureBox4.MouseDown
bln4 = True
bln1 = False
bln2 = False
bln3 = False
PictureBox3.DoDragDrop(PictureBox4.Image, DragDropEffects.All)
End Sub
Private Sub PictureBox5_Dragenter(sender As Object, e As DragEventArgs) Handles
PictureBox5.DragEnter
If e.Data.GetDataPresent(DataFormats.Bitmap) Then
e.Effect = DragDropEffects.Copy
Else
e.Effect = DragDropEffects.None
End If

End Sub
Private Sub PictureBox6_Dragenter(sender As Object, e As DragEventArgs) Handles
PictureBox6.DragEnter
If e.Data.GetDataPresent(DataFormats.Bitmap) Then
e.Effect = DragDropEffects.Copy
Else
e.Effect = DragDropEffects.None
End If
End Sub
Private Sub PictureBox7_Dragenter(sender As Object, e As DragEventArgs) Handles
PictureBox7.DragEnter
If e.Data.GetDataPresent(DataFormats.Bitmap) Then
e.Effect = DragDropEffects.Copy
Else
e.Effect = DragDropEffects.None
End If
End Sub
Private Sub PictureBox8_Dragenter(sender As Object, e As DragEventArgs) Handles
PictureBox8.DragEnter
If e.Data.GetDataPresent(DataFormats.Bitmap) Then
e.Effect = DragDropEffects.Copy
Else
e.Effect = DragDropEffects.None
End If
End Sub
Private Sub PictureBox5_Dragdrop(sender As Object, e As DragEventArgs) Handles
PictureBox5.DragDrop
Me.PictureBox5.Image = CType(e.Data.GetData(DataFormats.Bitmap), Bitmap)
If bln4 = True Then
Score += 3
Label7.Text = Score
Else MsgBox("Try again")
End If

End Sub
Private Sub PictureBox6_Dragdrop(sender As Object, e As DragEventArgs) Handles
PictureBox6.DragDrop
Me.PictureBox6.Image = CType(e.Data.GetData(DataFormats.Bitmap), Bitmap)
If bln3 = True Then
Score += 3
Label7.Text = Score
Else MsgBox("Try again")
End If

End Sub
Private Sub PictureBox7_Dragdrop(sender As Object, e As DragEventArgs) Handles
PictureBox7.DragDrop
Me.PictureBox7.Image = CType(e.Data.GetData(DataFormats.Bitmap), Bitmap)
If bln2 = True Then
Score += 3
Label7.Text = Score
Else MsgBox("Try again")
End If
End Sub
Private Sub PictureBox8_Dragdrop(sender As Object, e As DragEventArgs) Handles
PictureBox8.DragDrop
Me.PictureBox8.Image = CType(e.Data.GetData(DataFormats.Bitmap), Bitmap)
If bln1 = True Then
Score += 3
Label7.Text = Score
Else MsgBox("Try again")
End If
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Me.Close()
Last.Show()
End Sub
End Class

Last
Public Class Last
Private Sub Form4_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Label2.Text = Score
If Highscore = 0 Then
Highscore = Score
ElseIf Highscore < Score Then
Highscore = Score
End If
Label4.Text = Highscore
End Sub

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click


Score = 0
Match1.Label7.Text = 0
Match2.Label7.Text = 0
Match1.PictureBox5.Image = Nothing
Match1.PictureBox6.Image = Nothing
Match1.PictureBox7.Image = Nothing
Match1.PictureBox8.Image = Nothing
Match2.PictureBox5.Image = Nothing
Match2.PictureBox6.Image = Nothing
Match2.PictureBox7.Image = Nothing
Match2.PictureBox8.Image = Nothing
Me.Close()
Start.Show()
End Sub
End Class

Module
Module Module1
Public Score As Integer
Public Highscore As Integer
End Module

You might also like