This documentation is archived and is not being maintained.

DefaultTraceListener.AssertUiEnabled Property

Gets or sets a value indicating whether the application is running in user-interface mode.

Namespace: System.Diagnostics
Assembly: System (in system.dll)

public bool AssertUiEnabled { get; set; }
/** @property */
public boolean get_AssertUiEnabled ()

/** @property */
public void set_AssertUiEnabled (boolean value)

public function get AssertUiEnabled () : boolean

public function set AssertUiEnabled (value : boolean)

Property Value

true if user-interface mode is enabled; otherwise, false.

The following code example calls a function that calls the Fail(String,String) method to log an error message if the function throws an exception. If the AssertUiEnabled property is false, the method also writes the error message to the console.

' Compute the next binomial coefficient and handle all exceptions.
    result = CalcBinomial(possibilities, iter)
Catch ex As Exception
    Dim failMessage As String = String.Format( _
            "An exception was raised when " & _
            "calculating Binomial( {0}, {1} ).", _
            possibilities, iter)
    defaultListener.Fail(failmessage, ex.Message)
    If Not defaultListener.AssertUiEnabled Then
        Console.WriteLine(failMessage & vbCrLf & ex.Message)
    End If
End Try

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0