[AccessD] OT: VB.Net - general questions

Bob Bedell bobbedell15 at msn.com
Mon Jul 14 15:53:59 CDT 2003


Hi John,

To test:

Catch ex As Exception
       Console.WriteLine("Some other exception found: " & ex.ToString())

Add:

'Uncomment next line to test for IndexOutOfRangeException
'Console.WriteLine(mCollection(4))

to the console app. User-defiined collections in VB.NET
are 1 based. Just an after thought.

Bob


>From: <jcolby at colbyconsulting.com>
>Reply-To: Access Developers discussion and problem 
>solving<accessd at databaseadvisors.com>
>To: "VBA" <dba-vb at databaseadvisors.com>,   "AccessD" 
><AccessD at databaseadvisors.com>
>Subject: [AccessD] OT: VB.Net - general questions
>Date: Mon, 14 Jul 2003 14:16:56 -0400
>
>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
>
>
>_______________________________________________
>AccessD mailing list
>AccessD at databaseadvisors.com
>http://databaseadvisors.com/mailman/listinfo/accessd
>Website: http://www.databaseadvisors.com

_________________________________________________________________
MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*.  
http://join.msn.com/?page=features/virus



More information about the AccessD mailing list