How to convert error code to text??

  • Thread starter Thread starter **Developer**
  • Start date Start date
D

**Developer**

For WinSpool.SetPrinter a zero return indicates an error.

SetLastError defaults to True in VB so I can get the errorcode as follows:

ErrorCode = Marshal.GetLastWin32Error()

The value is 6 but that tells me very little.

Where can I find some text to better describe the error??





Thanks
 
Where can I find some text to better describe the error??

Manually, run "net helpmsg 6" in a console window, or run the Visual
C++ error lookup utility (can be installed with VS).

Programatically:

Dim e As New Win32Exception
errmsg = e.Message



Mattias
 
**Developer** said:
For WinSpool.SetPrinter a zero return indicates an error.

SetLastError defaults to True in VB so I can get the errorcode as follows:

ErrorCode = Marshal.GetLastWin32Error()

The value is 6 but that tells me very little.

Where can I find some text to better describe the error??

\\\
Dim s As String = _
(New Win32Exception(Marshal.GetLastWin32Error())).Message
///
 
Maybe I'm not doing it correctly

I pasted net helpmsg 6 after the prompt> in the Command Window and
hit CR and got:
Command "net" is not valid.



Thanks
 
Work perfectly


thanks


Herfried K. Wagner said:
\\\
Dim s As String = _
(New Win32Exception(Marshal.GetLastWin32Error())).Message
///
 
**Developer** said:
I pasted net helpmsg 6 after the prompt> in the Command Window and
hit CR and got:
Command "net" is not valid.

On my Windows XP Professional SP2 machine:

---
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\...>net helpmsg 6

Das Handle ist ungültig.


C:\...>
 
I'm probably doing something wrong.
Is that realy the way to do it?
Do I need to install something special?
Do I need to find the directory Net is in an give the full path?

Thanks
---
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\...>net helpmsg 6

Das Handle ist ungültig.


C:\...>
 
**Developer** said:
Is that realy the way to do it?
Do I need to install something special?
Do I need to find the directory Net is in an give the full path?

Mhm... I simply started "cmd" and entered the command. The directory
doesn't matter.
 
Well I couldn't get it to work so I tried Help and that worked. Got as far
as using immed and >cmd and will probably get net to work eventually - but
not yet. No big deal - I used your


\\\
Dim s As String = _
(New Win32Exception(Marshal.GetLastWin32Error())).Message
///

works great

Thanks

PS

After the > prompt I type
net helpmsg 6
and get
Command "net" is not valid
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top