jcolby at colbyconsulting.com
jcolby at colbyconsulting.com
Tue Jul 15 14:45:49 CDT 2003
Thanks, I'll read it. John W. Colby www.colbyconsulting.com -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com]On Behalf Of Gary Ray Sent: Tuesday, July 15, 2003 3:10 PM To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] OT: VB.Net - general questions John, Take a look at this article: http://www.vbdotnetheaven.com/Code/Apr2003/009.asp Basically, the System object exposes an Exception object that many of the other framework classes extend. I am not sure if there is a named object for a "missing collection exception", but if you look at the article it explains how to hande the select case type of exception traps that you are talking about. Gary Ray - Application Developer Workforce Information Systems R & D E-Mail gray at utah.gov >>> jcolby at colbyconsulting.com 07/14/03 12:16PM >>> I am porting my SysVars class to VB.Net just as an exercise. Of course I use the error handler insertion wizard for Access, but VB.Net has the new Try/catch error handling (which I very much like BTW). But it does mean that no port is trivial since I have to remove all the OnError / resume kind of stuff in every function. In my old code I have a case statement where I accumulated the various errors that could occur, and once handled a resume next would take me back into the code. that obviously has to change but I'm a little confused as to what it will change to. For example I have code that attempts to add an object to a collection: mcolObjNames.Add(strObjName, strObjName) There could be two problems here, the first is that no collection has been instantiated yet, the second is that the object is already in the collection. Thus a select case would be nice, which was how the old error handler in Access worked. Select case err case XXX case YYY Case else end select Now we have: Try mcolObjNames.Add(strObjName, strObjName) Catch e as XXXX (FIRST PROBLEM - WHAT IS xxxx?) Handle error here Finally End Try It certainly looks like e could be used in a select case statement. However to do so I need the equivalent of the "resume next". AND FINALLY... In access I also used a label for the exit such that all exiting code could go through the exit point for cleanup of pointers etc. The books I have don't ever show such a construct. John W. Colby www.colbyconsulting.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://databaseadvisors.com/pipermail/dba-vb/attachments/20030715/aee93548/attachment-0003.html>