MTSkull Posted June 26, 2003 Posted June 26, 2003 I notice in the error object we have an err.erl property, which the program tells me is the line where the error occurred. However when my program is running and calls this property it is always passing zeros. Is this an unimplemented feature or do I have to do something special to make it work? Brian Quote "Beer is proof that God loves us and wants us to be happy." -Benjamin Franklin
Administrators PlausiblyDamp Posted June 26, 2003 Administrators Posted June 26, 2003 Under .Net you really should be looking at using Exceptions rather than the on error goto method. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
AndreRyan Posted June 27, 2003 Posted June 27, 2003 Use Try..Catch Try 'Code that can crash Catch IOExc as IO.IOException Messagebox.Show("File Error: " & IOExc.Message) Catch Exc as Exception Messagebox.Show("General Error: " & Exc.Message) End Try Quote .Net allows software to be written for any version of Windows and not break like Unmanaged applications unless using Unmanaged procedures like APIs. If your program uses large amounts of memory but releases it when something else needs it, then what's the problem?
JABE Posted June 27, 2003 Posted June 27, 2003 Yeah, avoid On Error Goto. Structured Exception Handling is the way to go. To get the line number of the offending code, you can use the StackFrame class. There's a good sample from the 101 VB.NET Samples available from MS. Quote
MTSkull Posted June 27, 2003 Author Posted June 27, 2003 Thanks, I will look into that. Brian Quote "Beer is proof that God loves us and wants us to be happy." -Benjamin Franklin
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.