Module Module1 Sub Main() ' Error mode constants Const EM_SAVE As Integer = 1 Const EM_MESSAGE_BOX As Integer = 2 Const EM_EXCEPTION As Integer = 3 ' MESSAGE BOX MODE ' Enabled by default Console.WriteLine() Console.WriteLine("Message box mode") mn.DNS("ERROR") ' Cause error (mnStart needs to be used before mnDNS) ' SAVE MODE Console.WriteLine() Console.WriteLine("Save mode") mn.ToggleErrorMode(EM_MESSAGE_BOX) ' Disable error message boxes mn.ToggleErrorMode(EM_SAVE) ' Enable save mode mn.DNS("ERROR") ' Cause error ' mnGetErrorFlag or the return value can be used ' to determine if an error has occurred. mnGetErrorFlag ' overcomes the problem that some commands return different ' values upon error If (mn.GetErrorFlag() = True) Then Console.WriteLine("An error occurred whilst " + mn.GetErrorOperation()) End If ' EXCEPTION MODE Console.WriteLine() Console.WriteLine("Exception mode") mn.ToggleErrorMode(EM_SAVE) ' Disable save mode mn.ToggleErrorMode(EM_EXCEPTION) ' Enable exception mode Try mn.DNS("ERROR") ' Cause error Catch ErrorInfo As mnError Console.WriteLine("An error occurred whilst " + ErrorInfo.GetOperation()) End Try ' MULTIPLE MODES ' In this case: exception and message box ' Note: exception mode is already on Console.WriteLine() Console.WriteLine("Exception and message box mode (at the same time)") mn.ToggleErrorMode(EM_MESSAGE_BOX) ' Enable message box mode Try mn.DNS("ERROR") ' Cause error Catch ErrorInfo As mnError Console.WriteLine("An error occurred whilst " + ErrorInfo.GetOperation()) End Try Console.WriteLine() Console.WriteLine() Console.WriteLine("Press any key to exit...") Console.ReadKey() Return End Sub End Module