vb 幸运52 的问题 路过的都进来看看帮帮忙..

来源:百度知道 编辑:UC知道 时间:2024/06/04 12:02:15
Dim ma_lngcommodityprice(0 To 2) As Long
Dim m_intcurrontcommodity As Integer
Dim ma_strcommodityname(0 To 2) As String

Private Sub Command1_Click()
Command2.Enabled = True
Text1.SetFocus
Text1.Text = ""
Randomize
m_intcurrontcommodity = Int(3 * Rnd)
Dim inttemp As Integer
For inttemp = 0 To 2
Imgcommodidy(inttemp).Visible = False
Next inttemp
Imgcommodidy(m_intcurrontcommodity).Visible = True
End Sub

Private Sub Command2_Click() -运行的时候这个会出现错误提示:编译
Dim lngpricetemp As Long 错误,标签未定义
On Error GoTo inputerror
lngpricetemp = CLng(Text1.Text)
If lngpricetemp < 0 Then
MsgBox "您难道想我倒贴钱吗?", 0, "输入错误"
ElseIf lngpricetemp > ma_lngcommodityprice(m_intcurrontcommodity) Then
MsgBox "您想用 &text1.Text& 块来买这个破东西,高了高了", 0, "猜错了"
ElseIf lngpricetemp < ma_lngcommodityprice(m_intcurrontcommodity) Then

看了一下你写的这段程序,是有点错误。现在是可以过去的,不过要实现你想要的效果,还必须更改,你可以把具体要求做什么发上来,帮你看看!!

Dim ma_lngcommodityprice(0 To 2) As Long '这里已经定义了,下面就不要在定义了吧,要不然底下是会报找不到数组的错误的
Dim m_intcurrontcommodity As Integer
Dim strcommodityname(0 To 2) As String '这里已经定义了,下面就不要在定义了吧

Private Sub Command1_Click()
Command2.Enabled = True
Text1.SetFocus
Text1.Text = ""
Randomize
m_intcurrontcommodity = Int(3 * Rnd)
Dim inttemp As Integer
For inttemp = 0 To 2
Imgcommodidy(inttemp).Visible = False
Next inttemp
Imgcommodidy(m_intcurrontcommodity).Visible = True
End Sub

Private Sub Command2_Click() '-运行的时候这个会出现错误提示:编译
Dim lngpricetemp As Long '错误,标签未定义
On Error GoTo inputerror
lngpricetemp = CLng(Text1.Text)
If lngpricetemp < 0 Then
MsgBox "您难道想我倒贴钱吗?", 0, "输入错误"
ElseIf lngpricetemp > ma_lngcommodityprice(m_intcurrontcommodity) Then
MsgBox "您