I like the defensive programming.. but it needs practice...
-
If todayPos.Instrument.InstrumentTypeID <> TYPE_FIXEDINCOME OrElse todayPos.Instrument Is Nothing Then
Continue For
End IfIt works so much better if you do the defensive bit before the OrElse...
-
If todayPos.Instrument.InstrumentTypeID <> TYPE_FIXEDINCOME OrElse todayPos.Instrument Is Nothing Then
Continue For
End IfIt works so much better if you do the defensive bit before the OrElse...
Oh wait, that guy forgot another null check:
If todayPos.Instrument.InstrumentTypeID <> TYPE_FIXEDINCOME OrElse todayPos.Instrument Is Nothing OrElse todayPos Is Nothing Then
Continue For
End IfHope that helps with the ugly "reference not set to an object" exception you faced. :-\
-
If todayPos.Instrument.InstrumentTypeID <> TYPE_FIXEDINCOME OrElse todayPos.Instrument Is Nothing Then
Continue For
End IfIt works so much better if you do the defensive bit before the OrElse...
You must respect the putting of the cart before the horse! :doh:
"There are three kinds of lies: lies, damned lies and statistics." - Benjamin Disraeli