VB按下一题没反应

来源:百度知道 编辑:UC知道 时间:2024/05/25 13:30:28
代码:Private Sub cmdnext_Click()
i = i + i
Select Case i
Case 0
txtquestion.Text = "刘翔110米栏共用了多少时间(单位秒)"
Case 1
txtquestion.Text = "地球上有多少大洋"
Case 2
txtquestion.Text = "珠穆琅玛峰多高(单位米)"
Case 3
txtquestion.Text = "奥林匹克运动会在那年在中国举行"
Case 4
txtquestion.Text = "我国有多少个特别行政区"
End Select
Select Case i
Case 1
If txtanswer.Text = "12.91" Then sum = sum + 1
Case 2
If txtanswer.Text = "4" Then sum = sum + 1
Case 3
If txtanswer.Text = "8848" Then sum = sum + 1
Case 4
If txtanswer.Text = "2008" Then sum = sum + 1
Case 5
If txtanswer.Text = "2" Then sum = sum + 1
End Select
txtanswer.Text = ""
If i > 4 Or probar.Value = 100 Then cmdnext.Enabled = False
End Sub

i = i + i 这句错误,
不知道i是怎样定义的,如果没有定义
i的初值为0
i=i+i始终是零
应该是i=i+1
最好在通用中定义i
不过我看你的评分部分的作用好像实现不了。你试一下吧

在i = i + i 前面加上静态定义
Static i as Integer

或定义在全局变量中