Export (0) Print
Expand All

WarningException Class

Specifies an exception that is handled as a warning instead of an error.

For a list of all members of this type, see WarningException Members.

System.Object
   System.Exception
      System.SystemException
         System.ComponentModel.WarningException

[Visual Basic]
Public Class WarningException
   Inherits SystemException
[C#]
public class WarningException : SystemException
[C++]
public __gc class WarningException : public SystemException
[JScript]
public class WarningException extends SystemException

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Remarks

If this exception is not caught, it is presented to the user as a warning message. In the WarningException constructor, you can specify the Help file and Help topic to display if the user requests more information.

Example

[Visual Basic, C#, C++] The following example shows how to catch a warning and interpret its warning message.

[Visual Basic] 
Dim myEx As New WarningException("This is a warning")
Console.WriteLine(myEx.Message)
Console.WriteLine(myEx.ToString())

[C#] 
WarningException myEx=new WarningException("This is a warning");        
Console.WriteLine(myEx.Message);
Console.WriteLine(myEx.ToString());

[C++] 
WarningException* myEx = new WarningException(S"This is a warning");
Console::WriteLine(myEx->Message);
Console::WriteLine(myEx->ToString());

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Namespace: System.ComponentModel

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

Assembly: System (in System.dll)

See Also

WarningException Members | System.ComponentModel Namespace

Show:
© 2014 Microsoft