1) Code For Form 1
1) Code For Form 1
Imports System.Data.SqlClient
Public Class Form2
Dim mycon As SqlConnection
Dim mycom As SqlCommand
Public score As Integer
Dim w As Integer = 6
Dim x As Integer = 3
Dim y As Integer = 7
Dim z As Integer = 5
Dim S As Integer
Private Sub Panel1_Paint(sender As Object, e As PaintEventArgs) Handles Panel1.Paint
Timer1.Start()
End Sub
S = Label1.Text
If PictureBox1.Location.Y < 25 Or PictureBox5.Location.Y < 25 Or
PictureBox2.Location.Y < 25 Or PictureBox3.Location.Y < 25 Then
Me.Dispose()
MsgBox("GAME OVER!")
Form1.Show()
Try
mycon = New SqlConnection("Data Source=DESKTOP-M8QL80I;Initial
Catalog=antgame;Integrated Security=True")
mycom = New SqlCommand("insert into highscore values('" +
Form3.TextBox1.Text + "','" + S + "')", mycon)
mycon.Open()
mycom.ExecuteNonQuery()
mycon.Close()
Catch ex As Exception
MsgBox(ex.Message())
End Try
End If
End Sub