Share via


Description 屬性 (Err 物件)

更新:2007 年 11 月

傳回或設定包含錯誤相關說明字串的 String 運算式。讀取/寫入。

Public Property Description() As String

備註

Description 屬性設定是由錯誤的簡短描述組成。請利用這個屬性來警示使用者已發生您無法或無意處理的錯誤。當產生使用者定義的錯誤時,請將錯誤的簡短描述指派給 Description 屬性。如果未填入 Description 屬性,而且 Number 屬性的值對應於 Visual Basic 執行階段錯誤,則當錯誤產生時會將 ErrorToString 函式傳回的字串設定在 Description 屬性中。

範例

這個範例會將使用者定義的訊息指派給 Err 物件的 Description 屬性。

On Error Resume Next
Err.Raise(60000)
Err.Description = "Your Widget needs a new Frob!"
MsgBox(Err.Description)

需求

命名空間 (Namespace)︰Microsoft.VisualBasic

**模組︰**ErrObject

組件 (Assembly):Visual Basic Runtime Library (在 Microsoft.VisualBasic.dll 中)

請參閱

參考

Err 物件 (Visual Basic)

ErrorToString 函式

HelpContext 屬性 (Err 物件)

HelpFile 屬性 (Err 物件)

LastDllError 屬性 (Err 物件)

Number 屬性 (Err 物件)

Source 屬性 (Err 物件)