引用 | 編輯
soloman124
2006-12-07 18:57 |
樓主
▼ |
||
x0
要求Try to modify the program such than when user fail to input correct password more than 3 time, an error message will be displayed and does not allow user to try any more. 如何 .. 訪客只能看到部份內容,免費 加入會員 x0
|
引用 | 編輯
nomaid
2006-12-07 21:00 |
1樓
▲ ▼ |
複製程式
dim wrongval as integer '定義wrongval 為integer Dim username, password As String Dim LoginSuccess As Boolean = False wrongval = 0 '將wrongval 預設等於0 Do Until LoginSuccess username = InputBox("Username Please") password = InputBox("Password Please") If username = "Peter" And password = "1234" Then LoginSuccess = True else wrongval +=1 ' 判斷如果不等於的話 則wrongval + 1 End If if wrongval >3 then ' 判斷如果錯誤次數超過3則秀出彈跳視窗 messagebox.show("已輸入三次錯誤!!") end if Loop MsgBox ("Login success") 不曉得你要的錯誤畫面是什麼 隨便寫了一段 你自己看看吧 有附加說明 有問題的話 可以PM詢問~ x1 |
引用 | 編輯
soloman124
2006-12-07 21:50 |
2樓
▲ ▼ |
下面是引用nomaid於2006-12-7 21:00發表的 :多謝解答 唔明再問你 感激^__^ x0 |
引用 | 編輯
soloman124
2006-12-07 23:20 |
3樓
▲ ▼ |
下面是引用nomaid於2006-12-7 21:00發表的 :有bug 當三次失敗後再次成功時兩者都會 彈出成功和成敗@@ x0 |
引用 | 編輯
nomaid
2006-12-08 00:59 |
4樓
▲ ▼ |
你自行再判斷錯誤次數是否大於三後面加上中斷跳出的指令 (exit do)就可以了^^"
複製程式 if wrongval >3 then ' 判斷如果錯誤次數超過3則秀出彈跳視窗 messagebox.show("已輸入三次錯誤!!") exit do ' 新增的語法位置.. end if x0 |
引用 | 編輯
soloman124
2006-12-08 19:59 |
5樓
▲ ▼ |
下面是引用nomaid於2006-12-8 00:59發表的 :exit do 是點解? 多謝你 但我想知為什麼加me.close() 不能關閉 ? x0 |