请大家帮我解决一个vb,打小地鼠

世家好,笔者在做vb.net编制程序时,现身了这么一个标题,不精通该如何做,小编是学子,是新手,请懂的人帮帮作者,谢谢了!!!

打小地鼠

 

     小编是三个生手,对程序照旧有些精晓,做了叁个小游戏大家参照他事他说加以考察参照他事他说加以调查

未管理的“System.InvalidOperationException”类型的极度出以往 w.exe 中。

 

永利澳门游戏网址304,其它新闻: 创建窗体时出错。有关详细消息,请参阅
Exception.InnerException。错误为: 未将对象援引设置到指标的实例。
分界面log1代码如下:
Imports System.Data
Imports System.Data.SqlClient
Imports
System.Data.SqlClient.SqlConnection
Imports
System.Data.SqlClient.SqlDataReader
Public Class log1
    Inherits
System.Windows.Forms.Form

Public Class 打小地鼠
Dim rnd As
New Random()
Dim leter As New
Random()
Dim num, num1, time, time1, mark
As Integer
Dim a As String
Dim time2 As Integer = 2
Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged
RadioButton2.Checked = False
RadioButton3.Checked = False
time2 = 3
End Sub

    Dim myreader =
SqlCommand1.ExecuteReader()

Private Sub RadioButton3_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton3.CheckedChanged
RadioButton1.Checked = False
RadioButton2.Checked = False
time2 = 1
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Timer1.Enabled = True
TextBox1.Clear()
TextBox2.Clear()
TextBox1.Focus()
time = 0
time1 = 0
End Sub

    Function user() As Boolean
        SqlConnection1.Open()
        SqlCommand1 = New
SqlCommand(“SELECT * FROM 客商消息 WHERE 用户名=
‘” & TextBox1.Text & “‘”,
SqlConnection1卡塔尔国
        myreader = SqlCommand1.ExecuteReader()
        Dim TempString As String
        Dim type As String
        While myreader.Read
            TempString = myreader(“顾客密码”卡塔尔国
            type = myreader(“顾客类型”State of Qatar
        End While
        SqlConnection1.Close()
        myreader.Close()
        SqlCommand1.Dispose()
        If TextBox2.Text =
TempString And ComboBox1.Text = type
Then
            Return True
        Else
            If TextBox2.Text
<> TempString And
ComboBox1.Text <> type Then
                Return False
            End If
        End If
    End Function

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
a = TextBox1.Text.ToUpper
time += 1
time1 += 1
If time1 < 120 Then
If a = Chr(num) Then
mark += 1
TextBox2.Text = mark
End If
If time = time2 Or a = Chr(num) Then
num = rnd.Next(65, 90)
num1 = leter.Next(0, 10)
If num1 = 1 Or
num1 = 0 Then
Label1.Text = Chr(num)
Label2.Text = “*”
Label3.Text = “*”
Label4.Text = “*”
Label5.Text = “*”
Label6.Text = “*”
Label7.Text = “*”
Label8.Text = “*”
Label9.Text = “*”
If a = (Label1.Text) Then
mark += 1
TextBox2.Text = mark
End If
End If
If num1 = 2 Then
Label2.Text = Chr(num)
Label1.Text = “*”
Label3.Text = “*”
Label4.Text = “*”
Label5.Text = “*”
Label6.Text = “*”
Label7.Text = “*”
Label8.Text = “*”
Label9.Text = “*”
If a = (Label2.Text) Then
mark += 1
TextBox2.Text = mark
End If
End If
If num1 = 3 Then
Label3.Text = Chr(num)
Label2.Text = “*”
Label1.Text = “*”
Label4.Text = “*”
Label5.Text = “*”
Label6.Text = “*”
Label7.Text = “*”
Label8.Text = “*”
Label9.Text = “*”
If a = (Label3.Text) Then
mark += 1
TextBox2.Text = mark
End If
End If
If num1 = 4 Then
Label4.Text = Chr(num)
Label2.Text = “*”
Label3.Text = “*”
Label1.Text = “*”
Label5.Text = “*”
Label6.Text = “*”
Label7.Text = “*”
Label8.Text = “*”
Label9.Text = “*”
If a = (Label4.Text) Then
mark += 1
TextBox2.Text = mark
End If
End If
If num1 = 5 Then
Label5.Text = Chr(num)
Label2.Text = “*”
Label3.Text = “*”
Label4.Text = “*”
Label1.Text = “*”
Label6.Text = “*”
Label7.Text = “*”
Label8.Text = “*”
Label9.Text = “*”
If a = (Label5.Text) Then
mark += 1
TextBox2.Text = mark
End If
End If
If num1 = 6 Then
Label6.Text = Chr(num)
Label2.Text = “*”
Label3.Text = “*”
Label4.Text = “*”
Label5.Text = “*”
Label1.Text = “*”
Label7.Text = “*”
Label8.Text = “*”
Label9.Text = “*”
If a = (Label6.Text) Then
mark += 1
TextBox2.Text = mark
End If
End If
If num1 = 7 Then
Label7.Text = Chr(num)
Label2.Text = “*”
Label3.Text = “*”
Label4.Text = “*”
Label5.Text = “*”
Label6.Text = “*”
Label1.Text = “*”
Label8.Text = “*”
Label9.Text = “*”
If a = (Label7.Text) Then
mark += 1
TextBox2.Text = mark
End If
End If
If num1 = 8 Then
Label8.Text = Chr(num)
Label2.Text = “*”
Label3.Text = “*”
Label4.Text = “*”
Label5.Text = “*”
Label6.Text = “*”
Label7.Text = “*”
Label1.Text = “*”
Label9.Text = “*”
If a = (Label8.Text) Then
mark += 1
TextBox2.Text = mark
End If
End If
If num1 = 9 Or
num1 = 10 Then
Label9.Text = Chr(num)
Label2.Text = “*”
Label3.Text = “*”
Label4.Text = “*”
Label5.Text = “*”
Label6.Text = “*”
Label7.Text = “*”
Label8.Text = “*”
Label1.Text = “*”
If a = (Label9.Text) Then
mark += 1
TextBox2.Text = mark
End If
End If
time = 0
End If
TextBox1.Clear()
TextBox1.Focus()
End If
If time1 = 120 Then
Timer1.Enabled = False
MsgBox(“您的得分为:” & mark, , “打小地鼠”卡塔尔(قطر‎
time1 = 0
time = 0
End If
Label10.Text = (120 – time1) & “s”
End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim main As New
Form()
        If TextBox1.Text = “” Or
TextBox2.Text = “” Or ComboBox1.Text = “” Then
            MsgBox(“请输入相应音信!”, MsgBoxStyle.Information, “超级市场管理种类”State of Qatar

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Timer1.Enabled = False
MsgBox(“您的得分为:” & mark, , “打小地鼠”State of Qatar
time = 0
time1 = 0
TextBox2.Clear()
Timer1.Enabled = False
End Sub

        ElseIf TextBox1.Text
<> “” And TextBox2.Text <> “” And
ComboBox1.Text <> “” And user() = True Then
            main.Show()
        Else
            MsgBox(“密码不科学或领队消息不宽容!”)
        End If
    End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Timer1.Enabled = False
End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Me.Close()
    End Sub

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Timer1.Enabled = True
End Sub

分界面 main代码如下:
Public Class main
    Inherits
System.Windows.Forms.Form

End Class

    Private Sub ToolStripLabel6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripLabel6.Click

那是笔者做的三个相符打地鼠的小游戏,我们多提意见,也挺有意思的永利澳门游戏网址304 1那是图表

发表评论

电子邮件地址不会被公开。 必填项已用*标注