Can someone quick shed some light on this issue I am having?
I wanted to create 2 constructors for my object, one that takes an ID
value and one that takes a datarow.
If ID value is provided, it is going to get the info from the database
and populate itself. If a datarow is provided, then it will use the
row to populate itself.
So, I wanted to have the "by ID" function get a datarow from the
database, and then call the overloaded New function and pass in the
datarow, to keep all the logic in one place.
For example:
public sub New(ID as integer)
'Get Datarrow from DB
dim oRow as DataRow
call Me.New(oRow)
end sub
public sub New(Row as DataRow)
'Fill properties of class
end sub
Like that...
Now, I know that I can move the logic into another private method,
which is what I have done for a workaround, but is there a reason I am
not allowed to do this? Is this not a good way to work with overloaded
constructors?