![]() |
| ||
| Constructor overloading problem Hi all... I have a problem with constructor overloading in VB.NET and, I know how to solve it, but want to know the best way to do it... so here is the problem. I have two manually created constructors in a class, like this... and everything goes fine... until I try to do error catching like this Public Sub New(param1 As String)then, it says that, for the constructor with 2 parameters, the call to the other constructor has to be the first instruction to call... but that's not possible if I want to catch the errors produced by the first constructor (if I move the Me.New(param1) outside the Try then every error thrown by the first constructor will not be catched. I know that if I create a function (for example _New()) and overload this one, then, from the constructors I can just call the function and everything is solved (no Me.New() called), but I don't know if this is the correct way to go. Thanks in advance and sorry for my english (Im spanish) |
| ||
| Re: Constructor overloading problem Public Sub New(param1 As String, param2 as String) i think this will be enough , since the code of Me.New(param1) will be executed first , so u will catch the errors produced by the first constructor , right ? |
| ||
| Re: Constructor overloading problem Quote:
|
| All times are GMT -4. The time now is 5:18 am. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC