VB5.0問題 (急,20點)

2012-06-15 7:28 am
Private Sub Form_Load()
Dim Handbrake As Boolean
Handbrake = False
Dim Start As Boolean
Start = False
End Sub

Private Sub Command7_Click()
If Start = False Then
Start = True
ElseIf Start = True Then
Start = False
End If

If Handbrake = False And Start = True Then
Command1.Enabled = True
Command2.Enabled = True
Command3.Enabled = True
Command4.Enabled = True
Command5.Enabled = True
Command6.Enabled = True
Command8.Enabled = True
Command9.Enabled = True
Command10.Enabled = True
ElseIf Handbrake = True And Start = True Then
Command1.Enabled = False
Command2.Enabled = False
Command3.Enabled = False
Command4.Enabled = False
Command5.Enabled = True
Command6.Enabled = True
Command8.Enabled = True
Command9.Enabled = True
Command10.Enabled = True
ElseIf Start = False Then
Command1.Enabled = False
Command2.Enabled = False
Command3.Enabled = False
Command4.Enabled = False
Command5.Enabled = False
Command6.Enabled = False
Command8.Enabled = False
Command9.Enabled = False
Command10.Enabled = False
End If
End Sub

Private Sub Command11_Click()
If Start = True Then
Select Case Handbrake
Case Is = True
Command1.Enabled = False
Command2.Enabled = False
Command3.Enabled = False
Command4.Enabled = False
Case Is = False
Command1.Enabled = True
Command2.Enabled = True
Command3.Enabled = True
Command4.Enabled = True
End Select
End If
End Sub

結果Command7不能執行Start = False 那部分
而Command11不能執行
如何解決?

回答 (2)

2012-06-20 4:50 am
之前讀完個課程,課程有教到相關技巧
我覺得導師教得幾好
口啤幾好
有免費試睇
詳細可以參考進階Visual Basic 程式編寫基礎班
http://www.systematic.com.hk/vb.htm
2012-06-16 4:14 am
我相信你是把

IF ... THEN... ELSE...



IF...THEN...ELSEIF...

這兩個 STRUCTURE 混淆了.

想清楚應用那一個就不會錯了.

祝成功.



收錄日期: 2021-04-13 18:45:23
原文連結 [永久失效]:
https://hk.answers.yahoo.com/question/index?qid=20120614000051KK00666

檢視 Wayback Machine 備份