How To Catch Error Number In Vb.net
resources Windows Server 2012 resources Programs MSDN subscriptions Overview Benefits Administrators Students Microsoft Imagine Microsoft Student Partners ISV Startups TechRewards Events Community Magazine Forums Blogs Channel 9 Documentation APIs and reference Dev centers Retired content Samples We’re sorry. The content you requested has been removed. You’ll be auto redirected in 1 second. .NET Development Articles and Overviews Upgrading to Microsoft .NET Upgrading to Microsoft .NET Error Handling in Visual Basic .NET Error Handling in Visual Basic .NET Error Handling in Visual Basic .NET ADO.NET for the ADO Programmer Building an N-Tier Application in .NET Calling a .NET Component from a COM Component Calling COM Components from .NET Clients Common .NET Libraries for Developers Comparing System.Xml in Visual Studio .NET to Microsoft.XMLDOM in Visual Studio 6.0 Converting ASP to ASP.NET Creating Classes in Visual Basic .NET Creating Components in .NET Creating a Windows Form User Control Data Binding with Windows Forms and ADO.NET Designing a .NET Application Designing for Web or Desktop? Determining When to Use Windows Installer Versus XCOPY Differences Between Visual Basic 6.0 and .NET Controls Distributed Transactions in Visual Basic .NET Error Handling in Visual Basic .NET Getting Started with Windows Forms Inheritance and Interfaces Inheritance from a Base Class in Microsoft .NET Interacting with Message Queues Introduction to ASP.NET and Web Forms Introduction to Visual Studio .NET Managing Versions of an Application Migrating from the SOAP Toolkit to Web Services Overloading Methods in Visual Basic .NET Performing Drag-and-Drop Operations Raising Events and Responding to Events Replacing API Calls with .NET Framework Classes Structuring a .NET Application For Easy Deployment Understanding and Using Assemblies and Namespaces in .NET Using ActiveX Controls with Windows Forms in Visual Studio .NET Using ADO.NET Using COM+ Services in .NET Using Web Services Instead of DCOM Variable and Method Scope in Microsoft .
your question and get tips & solutions from a community of 418,556 IT Pros & Developers. It's quick & easy. How to get the Exception number P: n/a RSB Hi Every one, i am using the try Catch block.. and the Exception object has a Message Property but i want to Catch the Error Number so that based on the Error number i can display Different error message.... try{ } Catch (Exception ex) { errNum = ex.????? if (errNum == x) { do x } else if ( errNum == y) { do y } } so how do i find the https://msdn.microsoft.com/en-us/library/ms973849.aspx Error Number here.. Thanks RSB Nov 21 '05 #1 Post Reply Share this Question 7 Replies P: n/a Jon Skeet [C# MVP] RSB
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers http://stackoverflow.com/questions/13460656/how-to-use-stacktrace-to-return-error-line-number-in-vb-net or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up How to use Stacktrace to return Error Line Number in vb.net up vote 5 down vote favorite 4 I am trying to create some sort of error catching method that will return the error how to line number. We have an abort email that is sent out when a process aborts that gives us the err.number and err.description but I would like to know where is actually errors out. I know you can do the following: 1: code here 2: code here 3: code here etc. and use ERL to get the number but it would be tedious to type each line out like that. Is there either a way to automatically do this or would how to catch it be easier to use Stacktrace? If Stacktrace is better could you please show me an example? vb.net error-handling stack-trace erl share|improve this question asked Nov 19 '12 at 19:23 user1836775 28113 1 ERL is the old way of doing things from VB6. Is there a reason not to use TRY/Catch? The exception object has a nice stack trace and includes the line number. –PatFromCanada Nov 19 '12 at 19:31 add a comment| 4 Answers 4 active oldest votes up vote 6 down vote accepted Generating line numbers in exception stack traces is a built-in feature for the CLR. You do however have to provide the information it needs to map a code address to a line number. Switch to the Release configuration of your project. Project + Properties, Compile tab, Advanced Compile Options. Change the "Generate debug info" setting from pdb-only to Full. Deploy the .pdb files along with your program. Beware that the line number you get is always an estimate so do not blindly trust what you see. The mapping is imperfect due to the jitter optimizer inlining methods and otherwise moving code around to make the program run faster. share|improve this answer answered Nov 19 '12 at 19:36 Hans Passant 655k819621605 add a comment| up vote 12 down vote I have adapted an example from other forum, in my case, I wasn't getting the line number where the error was caused, so I