Little problem...
I have a class as follows
What I'm basically trying to do is pass a string into a function which performs it's own calculations and then returns a populated class.
The function is, quite large, so I've narrowed it down to the basics which is...
So far so good. But I'm getting the infamous "Object reference not set to an instance of an object" error when I'm calling the function, and I'm calling it as...
Any ideas where I'm going wrong?
I have a class as follows
Public Class MCEPartNo
Dim _HUMPartNo As String
Dim _HUMPartDescription As String
Property HUMPartNo() As String
Get
Return _HUMPartNo
End Get
Set(ByVal value As String)
_HUMPartNo = value
End Set
End Property
Property HUMPartDescription() As String
Get
Return _HUMPartDescription
End Get
Set(ByVal value As String)
_HUMPartDescription = value
End Set
End Property
End Class
What I'm basically trying to do is pass a string into a function which performs it's own calculations and then returns a populated class.
The function is, quite large, so I've narrowed it down to the basics which is...
Shared Function validateMCEPartNo(ByVal _MCEPartNo As String) As MCEPartNo
Dim a As New MCEPartNo
a.HUMPartNo = "PN"
a.HUMPartDescription = "PD"
End Function
So far so good. But I'm getting the infamous "Object reference not set to an instance of an object" error when I'm calling the function, and I'm calling it as...
Dim a As New MCEPartNo
a = validateMCEPartNo(Me.txtMCEPartNo.Text)
Me.txtHUMPartNo.Text = a.HUMPartNo
Me.txtHUMDescription.Text = a.HUMPartDescription
Me.chkHUMTicket.Focus()
Any ideas where I'm going wrong?