Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. .NET (Core and Framework)
  4. How to retrieve a system error message

How to retrieve a system error message

Scheduled Pinned Locked Moved .NET (Core and Framework)
tutorialquestionhelpworkspace
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    KeesVer
    wrote on last edited by
    #1

    Hello, I want to retrieve the text associated with a system error message from the windows resources. Example: Environment.GetResourceString('ArgumentOutOfRange_Index')); This code wont compile because GetResourceString is not a public method. So how can I get the error message for 'ArgumentOutOfRange_Index'? Thanks in advance! Kees Vermeulen

    M 1 Reply Last reply
    0
    • K KeesVer

      Hello, I want to retrieve the text associated with a system error message from the windows resources. Example: Environment.GetResourceString('ArgumentOutOfRange_Index')); This code wont compile because GetResourceString is not a public method. So how can I get the error message for 'ArgumentOutOfRange_Index'? Thanks in advance! Kees Vermeulen

      M Offline
      M Offline
      Mark Salsbery
      wrote on last edited by
      #2

      Something like this maybe...

      string errorMessage = new System.ComponentModel.Win32Exception(System.Runtime.InteropServices.Marshal.GetLastWin32Error()).Message;

      Or maybe p/invoke the Win32 FormatMessage() API. Mark

      Mark Salsbery Microsoft MVP - Visual C++ :java:

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups