Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

"Beer is proof that God loves us and wants us to be happy."

-Benjamin Franklin

Posted

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

.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?
Posted

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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...