check out the System.Exception object
http://msdn.microsoft.com/library/de...us/cpref/html/
frlrfSystemExceptionClassTopic.asp
Most exception will be derived from this base class and it providers several
properties - Message, Source, InnerException, StackTrace etc.
The exception type below (System.Runtime.InteropServices.COMException) will
automatically have these properties so you will be able to access the
exception message using the 'Message' property.
HTH
Ollie Riches
http://www.phoneanalyser.net
Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a programmer
helping programmers.
"jez123456" <je*******@discussions.microsoft.com> wrote in message
news:6A**********************************@microsof t.com...
Hi, I have a c# program for compacting msaccess databases and I'm now
setting up the exception handling.
For 2 different conditions I get the following messages.
System.Runtime.InteropServices.COMException (0x80040E4D): Not a valid
account name or password.
System.Runtime.InteropServices.COMException (0x80004005): You attempted to
open a database that is already opened exclusively by user 'Test1' on
machine 'Dta-TRP'. Try again when the database is available.
I need to show a customized message to show the exception. Is there anyway
to get the above exception text so that I can modify it slightly?
Thanks in advance.