M
mp
vbnet 2008 express
how to avoid the compiler warning:
Variable 'ArrayObjects' is used before it has been assigned a value. A null
null
reference exception could result at runtime.
given
Dim ArrayObjects() As AcadEntity
....some code...
Try
ReDim ArrayObjects(0)
ArrayObjects(UBound(ArrayObjects)) = oSideLine'(oSideLine is an acad entity)
Catch ex As ApplicationException
m_Util.Logentry("error " & ex.Message)
End Try
....more code...then...
Try
If ArrayObjects Is Nothing Then <------------here is the warning location at
"ArrayObjects"
m_Util.Logentry("error ArrayObjects Is Nothing")
Else
SelectionSetWblock.AddItems(ArrayObjects)
End If
Catch ex As ApplicationException
End Try
what should I be doing in such cases (using an array)
i wouldn't think you'd do Dim ArrayObjects() As AcadEntity = Nothing
like you might with a simple object???
thanks
mark
how to avoid the compiler warning:
Variable 'ArrayObjects' is used before it has been assigned a value. A null
null
reference exception could result at runtime.
given
Dim ArrayObjects() As AcadEntity
....some code...
Try
ReDim ArrayObjects(0)
ArrayObjects(UBound(ArrayObjects)) = oSideLine'(oSideLine is an acad entity)
Catch ex As ApplicationException
m_Util.Logentry("error " & ex.Message)
End Try
....more code...then...
Try
If ArrayObjects Is Nothing Then <------------here is the warning location at
"ArrayObjects"
m_Util.Logentry("error ArrayObjects Is Nothing")
Else
SelectionSetWblock.AddItems(ArrayObjects)
End If
Catch ex As ApplicationException
End Try
what should I be doing in such cases (using an array)
i wouldn't think you'd do Dim ArrayObjects() As AcadEntity = Nothing
like you might with a simple object???
thanks
mark