tag:blogger.com,1999:blog-6825852.post108720118382087331..comments2023-03-27T11:44:48.634+00:00Comments on Learning VB.NET: "Using" Statement in WhidbeyBenjimawoohttp://www.blogger.com/profile/06246234499394493455noreply@blogger.comBlogger3125tag:blogger.com,1999:blog-6825852.post-27825932215203670372010-12-09T08:47:29.984+00:002010-12-09T08:47:29.984+00:00I think it is two separate subjects.
The try catch...I think it is two separate subjects.<br />The try catch can be used for a multitude of error handling situations whereas the Using would be used in cases where objects should be type casted.<br />With that I mean that you may have code that needs to process a number of different objects (derived from the same base class) which has the same objective, but different implementations. So, your variable would contain an object which should act as an instance of a specific class in certain scenarios.<br />Your code would then look like this:<br />Dim processForm As Form = Nothing<br />Select Case parentForm.Name<br /> Case "MainForm"<br /> Using processForm As frmMain<br /> (process code here)<br /> End Using<br /> Case "AccountingForm"<br /> Using processForm As frmAccounting<br /> (process code here)<br /> End Using<br />End SelectAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-6825852.post-80442104424000470982009-11-20T21:59:56.217+00:002009-11-20T21:59:56.217+00:00Who knows where to download XRumer 5.0 Palladium? ...Who knows where to download XRumer 5.0 Palladium? <br />Help, please. All recommend this program to effectively advertise on the Internet, this is the best program!Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-6825852.post-88166385972056304982008-11-20T21:53:00.000+00:002008-11-20T21:53:00.000+00:00Thanks. That was helpful. The Microsoft document...Thanks. That was helpful. The Microsoft documentation didn't lay it out so easily.Anonymousnoreply@blogger.com