我做了VB软件,可惜在运行过程中出现Run-time error 6':overflow这个
不是是什么意思?
望各位高手帮帮忙
工程如下:
Private Sub Command1_Click()
Dim i As Integer
Dim j As Integer
If Val(txtnumber.Text) > 49 Or Val(txtnumber.Text) < 1 Then
MsgBox "输入数值要在1--49内"
Else
i = Val(txtnumber.Text) - 1
Text1(i).Text = Str(Val(Text1(i).Text) + Val(txtcoin.Text))
txtvalue = ""
Dim sum As Double
sum = 0
For j = 0 To 48
sum = sum + Val(Text1(j).Text)
Next j
txtvalue.Text = Str(sum)
End If
'Command1.Enabled = False
End Sub
Private Sub Command2_Click()
txtnumber.Text = ""
txtcoin.Text = ""
End Sub
Private Sub Command3_Click()
Dim i As Integer
Dim j As Integer
Dim sum As Long
Dim total As Long
sum = 0
total = 0
For i = 0 To 48
Label3(i).Caption = ""
Next
For i = 0 To 48
If Val(Text1(i).Text) > Val(txtresult.Text) Then
Label3(i).Caption = Str(Val(Text1(i).Text) - Val(txtresult.Text)) / 2
Text1(i).Text = txtresult.Text
Text1(i).ForeColor = QBColor(12)
End If
Next
For j = 0 To 48
sum = sum + Val(Label3(j))
Next
Txtyue.Text = Str(Val(Txtyue.Text) + sum)
For i = 0 To 48
total = total + Val(Text1(i))
Next
txtvalue = Str(total)
End Sub
Private Sub Form_Activate()
txtnumber.SetFocus
End Sub
Private Sub Form_Load()
If txtnumber.Text = "" And txtcoin = "" Then
Command1.Enabled = False
Command2.Enabled = False
Else
End If
Dim j As Integer
For j = 0 To 48
Text1(j).Text = ""
Next j
End Sub
Private Sub Label11_Click()
End Sub
Private Sub txtcoin_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Command1_Click
txtnumber.Text = ""
txtcoin.Text = ""
txtnumber.SetFocus
End If
End Sub
Private Sub txtnumber_Change()
Command1.Enabled = True
Command2.Enabled = True
End Sub
Private Sub txtnumber_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txtcoin.SetFocus
End If
End Sub
Private Sub txtresult_Change()
If txtresult.Text <> "" Then
Command3.Enabled = True
Else
Command3.Enabled = False
End If
End Sub