I'm trying to figure out how to use a class.
I have created a class:
Public Class bicluster
Public Property Vec As String
Public Property left As String
Public Property right As String
Public Property distance As Double
Public Property id As String
Public Sub New(ByVal Vec As String, Optional ByVal Left As String = "None", Optional ByVal Right As String = "None", Optional ByVal Distance As Double = 0, Optional ByVal Id As String = "None")
_left = Left
_right = Right
_vec = Vec
_id = Id
_distance = Distance
End Sub
End Class
I now need to create an array of the class and assign data to it:
Private Sub hcluster(ByVal tmpRows As String, Optional ByVal Distance As String = "pearson")
Dim rows() As String = tmpRows.Split(",")
Dim clust() As bicluster
For mloop As Integer = 0 To rows.Count - 1
clust(mloop) = New bicluster(mloop, , , , "1")
Next
End Sub
Private Sub Button3_Click(sender As System.Object, e As System.EventArgs) Handles Button3.Click
hcluster("1,2,3")
End Sub
What am I doing wrong here, I get an error: Object reference not set to an instance of an object.
Thanks in advance!