2008-11-29, 09:24 AM
|
#1
|
註冊會員
|
字串的一些問題
-------------------- 閱讀本主題的最佳解答--------------------
語法:
Private Sub Command1_Click()
On Error GoTo file_not_found:
If Check1.Value = 1 Then Shell "struptr_tw-b.bat" Else Shell "struptr_tw.bat"
Form1.WindowState = 1
Exit Sub
file_not_found:
MsgBox "啟動檔案時發生錯誤! 找不到啟動檔 'struptr_tw-b.bat' 或 'struptr_tw.bat' ,請重新安裝程式後再試一次。", vbCritical + vbOKOnly, "錯誤"
End Sub
-------------------
Private Sub Command2_Click()
On Error GoTo file_not_found:
If Check2.Value = 1 Then Shell "struptr_hk-b.bat" Else Shell "struptr_hk.bat"
Form1.WindowState = 1
Exit Sub
file_not_found:
MsgBox "啟動檔案時發生錯誤! 找不到啟動檔 'struptr_hk-b.bat' 或 'struptr_hk.bat' ,請重新安裝程式後再試一次。", vbCritical + vbOKOnly, "錯誤"
End Sub
----------------------
Private Sub Command8_Click()
On Error GoTo file_not_found
Shell "struptr_us.bat"
Form1.WindowState = 1
Exit Sub
file_not_found:
MsgBox "啟動檔案時發生錯誤! 找不到啟動檔 'struptr_us.bat' ,請重新安裝程式後再試一次。", vbCritical + vbOKOnly, "錯誤"
End Sub
各位前輩
以上MSGBOX的程式碼要如何修改才能對於往後程式維護的工作會比較方便
也就是說紅色字部份再某處只要改動過一次即可
程式中的其他MSGBOX語法中的訊息提示就能直接套用改動之後的程式碼
不需要如上語法要改動三次
請問要如何修改呢?
感恩
(command1 , command2 與 commad8 中的msgbox 稍有不同)
|
|
|
送花文章: 764,
收花文章: 211 篇, 收花: 412 次
|