Since you have created an instance of your object then the error has to
be happening in the [Some Code] you have before your try/catch block of
the send method. It is also possible that the error is occuring in the
some code located in your catch statements.
Without code can't really tell. You should be able to simply step
through the code and see on what line it blows. Then you will know
which object is null.
shapper wrote:
I did as follows:
Dim obj As New MyClass.Obj
Abraham Andres Luna wrote:
actually, you have to set that send() function as a static method if you
plan to just call it without instantiating the MyClass class
hope that helps
"shapper" <md*****@gmail.comwrote in message
news:11**********************@b28g2000cwb.googlegr oups.com...
| Hello,
|
| I have a function inside a compiled class which code is as follows:
|
|
| Public Function Send() As Boolean
|
| ' [Some code]
|
| Try
|
| ' [Some code]
|
| Return True
|
| Catch ex As Exception
|
| ' [Some code]
|
| Return False
|
| End Try
|
| End Function
|
|
| In my aspx.vb code I have:
|
| Dim obj As New MyNamespace.MyClass
|
| If obj.Send Then
|
| Else
|
| End If
|
| I am getting an error on code line "If obj.Send Then":
|
| System.NullReferenceException: Object reference not set to an instance
| of an object.
|
| I have no idea what is going on. Shouldn't my class function return
| true or false?
|
| Thanks,
|
| Miguel
|