ErrObject.HelpFile 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
回傳或設定 String 包含完整限定路徑的說明檔案表達式。 讀/寫。
public:
property System::String ^ HelpFile { System::String ^ get(); void set(System::String ^ value); };
public string HelpFile { get; set; }
member this.HelpFile : string with get, set
Public Property HelpFile As String
屬性值
回傳或設定 String 包含完整限定路徑的說明檔案表達式。 讀/寫。
範例
此範例使用 HelpFile 物件的屬性 Err 來啟動幫助系統。 預設情況下,HelpFile 屬性包含 Visual Basic 說明檔案的名稱。
Dim Msg As String
Err.Clear()
On Error Resume Next ' Suppress errors for demonstration purposes.
Err.Raise(6) ' Generate "Overflow" error.
If Err.Number <> 0 Then
Msg = "Press F1 or HELP to see " & Err.HelpFile & " topic for" &
" the following HelpContext: " & Err.HelpContext
MsgBox(Msg, , "Error:")
End If
備註
如果說明檔案是由 HelpFile 屬性指定,使用者在錯誤訊息對話框中按下說明鍵(或 F1 鍵)時,該檔案會自動被呼叫。 如果該 HelpContext 屬性包含指定檔案的有效上下文 ID,該主題會自動顯示。 若未指定 HelpFile,則顯示 Visual Basic 說明檔案。
備註
你應該在應用程式中寫例程來處理典型錯誤。 在使用物件程式設計時,你可以使用該物件的說明檔案來提升錯誤處理的品質,或在錯誤無法復原時向使用者顯示有意義的訊息。