Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
VB.NET 2002/2003 Basics For coders who are new to Visual Basic, working in .NET versions 2002 or 2003 (1.0 and 1.1).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB.NET 2002/2003 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 13th, 2004, 10:14 AM
Friend of Wrox
 
Join Date: Sep 2003
Location: , Kent, United Kingdom.
Posts: 130
Thanks: 0
Thanked 0 Times in 0 Posts
Default Error Handling

Is there a way within a try catch to make the code continue even though there was an error?

Louisa

 
Old May 13th, 2004, 10:22 AM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Sure you can. You can nest the statement you expect to cause a problem in its own try block, like this:

try
{
  // Lots of statements here

  // Statement that might cause an error you want to ignore
  try
  {
    DoSomething();
  }
  catch {}

  // Lots of other statements here
}
catch {}

So, when the inner try block throws an error, the rest of the code will just continue.

HtH,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: The Tale of Dusty and Pistol Pete by Smashing Pumpkins (Track 10 from the album: Adore) What's This?




Similar Threads
Thread Thread Starter Forum Replies Last Post
error handling Abhinav_jain_mca General .NET 5 December 21st, 2005 01:12 AM
Error Handling twbit BOOK: ASP.NET Website Programming Problem-Design-Solution 1 May 3rd, 2005 09:18 PM
Error handling Hudson40 Access VBA 2 February 11th, 2005 05:32 AM
Error Handling zaeem Classic ASP Basics 2 November 14th, 2003 10:42 AM
Error handling ! ittorget Classic ASP Professional 2 November 14th, 2003 09:44 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.