這是一個電阻值測驗(有bug我找了很久執行時,有時候還有出現錯誤)(編號:5630)

各位vb的高手們這是個電阻值測驗的程式(本有三個表單,我只貼出有問題的表單)
在比對答案時,程式答案有時候會出現不一樣的答案,有時卻是對的!
可不可以幫我找出來這個問題(答案出錯)是那裡打錯了!!
如各位vb高手這樣看很困難的話,我可以把專案傳給你..
cwz000176@ms73.tonet.net

Dim a
Dim b
Dim c
Dim d
Dim cc
Dim qq, count1, count2, caption2, caption1
Dim er$, tt$, tt1$
Dim colorvalue(12)
Dim ErArray(2)
Dim sec, sec1
Private Sub Command1_Click()
If sec = "ocean" Then
Timer1.Enabled = False
Else
If sec1 = 1 Then
  sec = 15
  Timer1.Enabled = True
 Else
  If sec1 = 2 Then
   sec = 20
   Timer1.Enabled = True
  End If
 End If
End If
For i = 0 To 2
Text1(i).Text = ""
Text3(i).Text = ""
Next i

count1 = count1 + 1

'設定caption變數改變Command1.Caption文字
caption2 = caption2 + 1
If caption1 = 0 Then Command1.Caption = "下一題" & "(" & caption2 & ")"
Command3.Enabled = True
Command2.Enabled = True
'產生4個亂數用 select 去辨別
Randomize
a = Int(Rnd * 9 + 1) '第一個色碼不能為黑色"0"
b = Int(Rnd * 10)
c = Int(Rnd * 12)
d = Int(Rnd * 3)
cc = 0
'執行隨機頻色副程式
showcolor
Command1.Enabled = False
End Sub
Private Sub Command2_Click()
For i = 0 To 2
Text1(i).Text = ""
Text3(i).Text = ""
Next i
MsgBox ("您選擇跳一題,猜題題數加一題")
If sec = "ocean" Then
Timer1.Enabled = False
Else
If sec1 = 1 Then
  sec = 15
  Timer1.Enabled = True
 Else
  If sec1 = 2 Then
   sec = 20
   Timer1.Enabled = True
  End If
 End If
End If
'辨別題數是否到達第10題
count1 = count1 + 1
If count1 = 10 Or count2 = 10 Then
Command1.Enabled = False
End If
'設定caption變數改變Command1.Caption文字
caption2 = caption2 + 1
If caption1 = 0 Then Command1.Caption = "下一題" & "(" & caption2 & ")"
Command3.Enabled = True
'產生4個亂數用 select 去辨別
Randomize
a = Int(Rnd * 9 + 1) '第一個色碼不能為黑色"0"
b = Int(Rnd * 10)
c = Int(Rnd * 12)
d = Int(Rnd * 3)
aa = 0
bb = 0
cc = 0
dd = 0
'執行隨機頻色副程式
showcolor
Command1.Enabled = False
If count2 = 11 Or count1 = 11 Then
MsgBox ("色碼電阻測驗試題測驗結束!!" & "  您得到了 " & ert & " 分")
  Command1.Enabled = False
  Command2.Enabled = False
  Command3.Enabled = False
  Command1.Caption = "猜題結束"
End If
End Sub
Private Sub Command3_Click()
Timer1.Enabled = False
'辨別是否到達第10題
count2 = count2 + 1
'辨別是否有輸入電阻值
If Text1(0) = "" And Text1(1) = "" And Text1(2) = "" Then
MsgBox ("抱歉您還沒輸入電阻數值!!")
Else
Command1.Enabled = True
  '答案
  If c = 0 Then
   ans = a & b & c & er$
  Else
   ans1 = a & b
   'ans = ans1 * c & er$
  End If
 
  Text3(0).Text = Val(ans1 * c) & er$
  Text3(1).Text = (Val(ans1 * c) / 10 ^ 3) & er$
  Text3(2).Text = (Val(ans1 * c) / 10 ^ 6) & er$
  
 If Text1(0).Text = Text3(0).Text Or Text1(1).Text = Text3(1).Text Or Text1(2).Text = Text3(2).Text Then
  MsgBox ("恭喜您答對了!!")
  ert = ert + 1
  Label2.Caption = "您目前共對了" & " " & ert & " " & " 題"
  Command3.Enabled = False
  Command2.Enabled = False
 Else
  If Text1(Index).Text <> Text3(Index).Text Then
   MsgBox ("抱歉您答錯了!!")
   Command3.Enabled = False
   Command2.Enabled = False
  End If
 End If
 
  If count2 = 11 Or count1 = 11 Then
   MsgBox ("色碼電阻測驗試題測驗結束!!")
   Command1.Enabled = False
   Command2.Enabled = False
   Command3.Enabled = False
   Command1.Caption = "猜題結束"
  End If
 
End If
End Sub
Private Sub Form_Load()
20 user = InputBox("輸入使用者名稱", "電阻值測驗程式", "入侵者")
If user = "" Then
MsgBox ("請輸入使用者名稱")
 GoTo 20
End If
Command1.Enabled = False
Command2.Enabled = False
Command3.Enabled = False
colorvalue(0) = 0          '黑
  colorvalue(1) = RGB(128, 64, 0)   '棕
  colorvalue(2) = RGB(255, 0, 0)   '紅
  colorvalue(3) = RGB(255, 128, 0)  '橙
  colorvalue(4) = RGB(255, 255, 0)  '黃
  colorvalue(5) = RGB(0, 255, 0)   '綠
  colorvalue(6) = RGB(0, 0, 255)   '藍
  colorvalue(7) = RGB(128, 0, 128)  '紫
  colorvalue(8) = RGB(128, 128, 128) '灰
  colorvalue(9) = RGB(255, 255, 255) '白
  colorvalue(10) = RGB(225, 225, 202) '金
  colorvalue(11) = RGB(242, 242, 242) '銀
  colorvalue(12) = RGB(255, 255, 255) '無
  
  ErArray(0) = "+-5%"
  ErArray(1) = "+-10%"
  ErArray(2) = "+-20%"

a = 0
b = 0
c = 0
cc = 0
d = 0
er$ = 0
count1 = 0
count2 = 0
ert = 0
caption1 = 0
caption2 = 0
sec = 0
sec1 = 0
End Sub

Public Sub showcolor()

Picture1.BackColor = colorvalue(a)
Picture2.BackColor = colorvalue(b)
Picture3.BackColor = colorvalue(c)
Select Case True
  Case c < 9
  c = 10 ^ c
  Case c > 9
  c = 10 ^ -(c - 9)
End Select

er$ = ErArray(d)
Picture4.BackColor = colorvalue(d + 10)
End Sub
Private Sub level11_Click()
level11.Enabled = True
level22.Enabled = False
level33.Enabled = False
Command1.Enabled = True
sec1 = 1
End Sub
Private Sub level22_Click()
level22.Enabled = True
level11.Enabled = False
level33.Enabled = False
Command1.Enabled = True
sec1 = 2
End Sub
Private Sub level33_Click()
level33.Enabled = True
level22.Enabled = False
level11.Enabled = False
Timer1.Enabled = False
Command1.Enabled = True
sec = "ocean" '設定猜題秒數為無限秒
Label1.Caption = "猜題秒數為∞秒"
End Sub
Private Sub name_Click()
Form4.Show
End Sub
Private Sub say1_Click()
Form2.Show
End Sub
Private Sub Timer1_Timer()
sec = sec - 1
Label1.Caption = "目前剩下秒數為" & sec & "秒"
If sec <= 0 Then
MsgBox ("你嘛幫幫忙!沒那個實力就選等級三咩!")
 Command1.Enabled = True
 Command2.Enabled = False
 Command3.Enabled = False
  '答案
  If c = 0 Then
   ans = a & b & c & er$
  Else
   ans1 = a & b
  End If
 
  Text3(0).Text = Val(ans1 * c) & er$
  Text3(1).Text = (Val(ans1 * c) / 10 ^ 3) & er$
  Text3(2).Text = (Val(ans1 * c) / 10 ^ 6) & er$
  Timer1.Enabled = False
  
End If
End Sub