ErrObject.HelpFile 屬性

定義

傳回或設定 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如果屬性包含指定檔案的有效內容識別碼,則會自動顯示該主題。 HelpFile如果未指定 ,則會顯示 Visual Basic 說明檔。

注意

您應該在應用程式中撰寫例程來處理一般錯誤。 使用 物件進行程式設計時,您可以使用物件的說明檔來改善錯誤處理的品質,或在錯誤無法復原時向用戶顯示有意義的訊息。

適用於

另請參閱