在VB程序运行中出现“必选参数”是什么意思啊
以下是我编写的程序:PrivateSubCommand1_Click()DimsAsDoubles=right/t*100MsgBox"你一共做了"&t&"道题,"&"对...
以下是我编写的程序:Private Sub Command1_Click()
Dim s As Double
s = right / t * 100
MsgBox "你一共做了" & t & "道题," & "对了" & right & "道," & "你的得分是" & s, , "你的得分"
End Sub
Private Sub Text4_KeyPress(KeyAscii As Integer)
Dim t As Integer, s As Double
Dim right, wring As Long
right = 0
wrong = 0
t = 0
If Text3 = Val(Text1) + Val(Text2) Then
right = right + 1
Text4 = Text4 & vbCrLf & Text1 & " + " & Text2 & " = " & Text3 & " √ "
Else
Texwrong = wrong + 1
Text4 = Text4 & vbCrLf & Text1 & " + " & Text2 & " = " & Text3 & " × " & " " & "正确答案是" & Str(Val(Text1) + Val(Text2))
End If
t = t + 1
End Sub 展开
Dim s As Double
s = right / t * 100
MsgBox "你一共做了" & t & "道题," & "对了" & right & "道," & "你的得分是" & s, , "你的得分"
End Sub
Private Sub Text4_KeyPress(KeyAscii As Integer)
Dim t As Integer, s As Double
Dim right, wring As Long
right = 0
wrong = 0
t = 0
If Text3 = Val(Text1) + Val(Text2) Then
right = right + 1
Text4 = Text4 & vbCrLf & Text1 & " + " & Text2 & " = " & Text3 & " √ "
Else
Texwrong = wrong + 1
Text4 = Text4 & vbCrLf & Text1 & " + " & Text2 & " = " & Text3 & " × " & " " & "正确答案是" & Str(Val(Text1) + Val(Text2))
End If
t = t + 1
End Sub 展开
2个回答
展开全部
Dim s As Double
Dim right, wring, t As Long
Private Sub Command1_Click()
s = right / t * 100
MsgBox "你一共做了" & t & "道题," & "对了" & right & "道," & "你的得分是" & s, , "你的得分"
Text4.Text = ""
End Sub
Private Sub Text4_KeyPress(KeyAscii As Integer)
Dim s As Double
If Text3 = Val(Text1) + Val(Text2) Then
right = right + 1
Text4 = Text4 & vbCrLf & Text1 & " + " & Text2 & " = " & Text3 & " √ "
Else
Texwrong = wrong + 1
Text4 = Text4 & vbCrLf & Text1 & " + " & Text2 & " = " & Text3 & " × " & " " & "正确答案是" & Str(Val(Text1) + Val(Text2))
End If
t = t + 1
End Sub
以上程序可以实现你的要求:
说一下你的程序:
s,t,right,wrong都是全局变量所以要在程序的最前面定义
你在Text4_KeyPress事件中定义的它们只是私有的就是只在Text4_KeyPress事件中起作用:所以才会提示“必选参数”
再一个就是按钮按下之后最好清除text4中的内容否则
再一次发生Text4_KeyPress事件text4中的内容有些混乱
Dim right, wring, t As Long
Private Sub Command1_Click()
s = right / t * 100
MsgBox "你一共做了" & t & "道题," & "对了" & right & "道," & "你的得分是" & s, , "你的得分"
Text4.Text = ""
End Sub
Private Sub Text4_KeyPress(KeyAscii As Integer)
Dim s As Double
If Text3 = Val(Text1) + Val(Text2) Then
right = right + 1
Text4 = Text4 & vbCrLf & Text1 & " + " & Text2 & " = " & Text3 & " √ "
Else
Texwrong = wrong + 1
Text4 = Text4 & vbCrLf & Text1 & " + " & Text2 & " = " & Text3 & " × " & " " & "正确答案是" & Str(Val(Text1) + Val(Text2))
End If
t = t + 1
End Sub
以上程序可以实现你的要求:
说一下你的程序:
s,t,right,wrong都是全局变量所以要在程序的最前面定义
你在Text4_KeyPress事件中定义的它们只是私有的就是只在Text4_KeyPress事件中起作用:所以才会提示“必选参数”
再一个就是按钮按下之后最好清除text4中的内容否则
再一次发生Text4_KeyPress事件text4中的内容有些混乱
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询