473,385 Members | 2,013 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

How to convert error code to text??

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


Nov 21 '05 #1
8 4106
>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

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Nov 21 '05 #2
" **Developer**" <RE*************@a-znet.com> schrieb:
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())).Messa ge
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #3
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
"Mattias Sjögren" <ma********************@mvps.org> wrote in message
news:Oc****************@TK2MSFTNGP09.phx.gbl...
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

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.

Nov 21 '05 #4
Work perfectly
thanks
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
" **Developer**" <RE*************@a-znet.com> schrieb:
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())).Messa ge
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #5
" **Developer**" <RE*************@a-znet.com> schrieb:
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:\...>
---

Translated: The handle is invalid.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #6
I'm probably doing something wrong.
I pasted net helpmsg 6 after the prompt> in the Command Window and
hit CR

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:\...>
---

Translated: The handle is invalid.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #7
" **Developer**" <RE*************@a-znet.com> schrieb:
I pasted net helpmsg 6 after the prompt> in the Command Window
and hit CR


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.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #8
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())).Messa ge
///

works great

Thanks

PS

After the > prompt I type
net helpmsg 6
and get
Command "net" is not valid
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:eM****************@TK2MSFTNGP14.phx.gbl...
" **Developer**" <RE*************@a-znet.com> schrieb:
I pasted net helpmsg 6 after the prompt> in the Command Window
and hit CR


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.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Erwin Bormans | last post by:
Hello I want to convert a value in a text propertie to a double. I can use CDbl(grid1.text) for this, but the problem is that some text properties are empty and when they are the code give...
7
by: whatluo | last post by:
Hi, all I'm now working on a program which will convert dec number to hex and oct and bin respectively, I've checked the clc but with no luck, so can anybody give me a hit how to make this done...
4
by: Serge Klokov | last post by:
Hello! I have a Oracle table with a BLOB field. Each field is actually a simple text file of several lines. How to get this BLOB fields in readable format? I tryied something like...
2
by: Joebloggs | last post by:
Hi I am trying to do an ldap lookup. I can pick up the domain name in the standard format DOMAIN\USERNAME. The problem is the company I work for expects the query in the format DOMAIN:USERNAME....
2
by: Patrick Olurotimi Ige | last post by:
When i convert:- this code from VB to C# Why do i get error "Cannot implicitly convert type 'object' to 'bool' VB --- If cmdcommand.Parameters("ReturnValue").Value = 1 Then lblStatus.Text =...
9
by: keliie | last post by:
Hello (from Access novice), I'm building a switchboard form (using a Treeview object). The treeview is populated by two tables (tblSwitchboardParent and tblSwitchboardChild). Within...
3
by: shapper | last post by:
Hello, Could someone tell me how to convert a XML file into another XML file using a XSL file with a parameter? I created the code to do it, and it seems ok, but it is not working. Could...
7
by: elliotng.ee | last post by:
I have a text file that contains a header 32-bit binary. For example, the text file could be: %%This is the input text %%test.txt Date: Tue Dec 26 14:03:35 2006...
3
by: mrajanikrishna | last post by:
Hi Friends, I am accepting a number from the user entered in a textbox. I want to assign to a variable in my code and assignt this to that variable. double num1 = (double)txtNum1.text; ...
0
Debadatta Mishra
by: Debadatta Mishra | last post by:
Introduction In this article I will provide you an approach to manipulate an image file. This article gives you an insight into some tricks in java so that you can conceal sensitive information...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.