E
Eidolon
Is there any way that you can write your constructor so that it returns
nothing?
For example:
Take a Customer object which has a constructor whose constructor has the
signiture:
Public Sub New(CustomerID as String)
What i would like to do is to write it so that the the actual code of the
constructor goes something like the following pseudo-code:
<pcode>
Dim dt as datatable = getDataTable(SELECT * FROM CUSTOMER WHERE CUSTID =
CustomerID)
If dt.Rows.Count = 0 then
return nothing
Else
InitializeMe(dt.Rows(0))
End if
</pcode>
This way from my client code i can do something like:
<code>
Dim tmpCust As Customer = New Customer(MyParameter)
If IsNothing(tmpCust) Then
ShowNoCustMsg
Else
ConitnueOn()
End If
</code>
Thanks in advance.
nothing?
For example:
Take a Customer object which has a constructor whose constructor has the
signiture:
Public Sub New(CustomerID as String)
What i would like to do is to write it so that the the actual code of the
constructor goes something like the following pseudo-code:
<pcode>
Dim dt as datatable = getDataTable(SELECT * FROM CUSTOMER WHERE CUSTID =
CustomerID)
If dt.Rows.Count = 0 then
return nothing
Else
InitializeMe(dt.Rows(0))
End if
</pcode>
This way from my client code i can do something like:
<code>
Dim tmpCust As Customer = New Customer(MyParameter)
If IsNothing(tmpCust) Then
ShowNoCustMsg
Else
ConitnueOn()
End If
</code>
Thanks in advance.