Board logo

標題: 求救vb [打印本頁]

作者: p5628    時間: 2011-4-24 22:24     標題: 求救vb

我想作一個vb記憶遊戲~可是跑不出來......
可以請問有誰可以幫我看看我的原始碼哪裡錯~~(我是初學者

Dim flag As Boolean
Dim pair As Integer
Dim start As Single
Dim temp As Integer
Dim press1 As ImageList, press As ImageList
Dim 符號 As ImageList
Dim 按鈕 As ImageList
Dim 完成對數 As Integer, 次數 As Integer

Private Sub cmd開始_click()
Dim i As Integer

Timer1.Interval = 0
start = Timer
Timer1.Interval = 100
完成對數 = 0
次數 = 0
For i = 0 To 8
按鈕(i).Enabled = True
按鈕(i).Caption = ""
Next i

End Sub

Private Sub timer1_timer()
Lbl時間.Caption = "時間:" + Str$(Timer - start) + "秒"
End Sub
Private Sub 按鈕_click(index As Integer)
Dim i
次數 = 次數 + 1
    Lbl次數 = "次數:" + Str$(次數)
    pair = pair + 1
   
    If pair = 2 Then
    pair = 0
    Press2 = 0
    If press1 <> Press2 Then
    P2 = 符號(index)
    flag = True
    按鈕(Press2).Caption = P2
    If P2 = P1 Then
    完成對數 = 完成對數 + 1
    按鈕(press1).Enabled = False
    按鈕(Press2).Enabled = False
    flag = False
    If 完成對數 = 8 Then Timer1.Interval = 0
    End If
    Else
      次數 = 次數 + 1
      pair = 1
    End If
Else
   If flag = True Then
     按鈕(press1).Caption = ""
     按鈕(Press2).Caption = ""
     flag = False
   End If
   
   press1 = index
   P1 = 符號(index)
   按鈕(press1).Caption = P1
   
   End If
   
End Sub




歡迎光臨 麻辣家族討論版版 (http://forum.twbts.com/)