property NETObjectTemplate.TemplateError as Long
Indicates the error code of the last Template call.

TypeDescription
Long A long expression that describes the error/exception in the Item/Template call.
By default, the TemplateError property returns 0. The TemplateError / TemplateException property indicates the error/exception that occurred in the Item/Template call. The TemplateThrowError property specifies whether the control fires an exception/error when the Template call fails. The TemplateError / TemplateException gets the error if the Template calls fails.

By default, the control fires an exception/error when the Item/Template call fails like shown in the following screen shot:

while running the following code:

Private Sub Form_Load()
    With NETHost1
        .AssemblyQualifiedName = "System.Windows.Forms.PropertyGrid, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
        With .Host
            .Template = "BackColor = RGB(255,255,255);ViewBackColor = RGB(255,255,255);LineColor = ViewBackColor"
            .SetTemplateDef "dim object"
            .SetTemplateDef Me
            .Template = "XXXSelectedObject = object"
        End With
    End With
End Sub

where intentionally we used XXXSelectedObject instead of SelectedObject property of the /NET Framework's PropertyGrid.

If the TemplateThrowError property is False ( by default, it is True ), you can get the error/exception using the TemplateError / TemplateException property as:

TemplateError is -2147352570
TemplateException is XXXSelectedObject = object # Unknown property / method / identifer / variable (XXXSelectedObject, System.Windows.Forms.PropertyGrid)