At the moment i am just playing around with functions and i keep getting this annoying error message with the code below
An unhandled exception of type System.NullReferenceException occurred in Procedures and Functions - Hr 10.exe
Additional information: Object reference not set to an instance of an object.
Can someone please point me in the right direction?
An unhandled exception of type System.NullReferenceException occurred in Procedures and Functions - Hr 10.exe
Additional information: Object reference not set to an instance of an object.
Code:
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim c As Class1
Dim i As Integer
i = c.ComputeLength("hELLO")
MsgBox(i)
End Sub
Code:
Public Class Class1
Public Function ComputeLength(ByVal strText As String) As Integer
Return strText.Length
End Function
End Class
Can someone please point me in the right direction?