Hello, this is my first post to this forum. Please forgive me if I am repeating a question or am posting in the wrong area.
Here's my dilemma.
I have declared a structure and an array on my module as such:
On a child form, I have data from a database that populates related lables upon a selected index change from a combobox.
What I'd like to do is allow the user to add the data that is populated to the array/structure, change the selected index/data and add the newly populated date to the next index of the array/structure. This is what I have for that code:
In the execution, when I click on the Add button, I get the following error:
An unhandled exception of type 'System.NullReferenceException' occurred in Kens Music.exe
Additional information: Object reference not set to an instance of an object.
Do I need to declare an instance of the structure/array before i I can use it?
If anyone can help me, that would be super.
Thanks.
Here's my dilemma.
I have declared a structure and an array on my module as such:
Visual Basic:
Friend Structure stcOrder
Friend strArtist As String
Friend strTitle As String
Friend intTracks As Integer
Friend decPrice As Decimal
End Structure
Friend aryOrder() As stcOrder
On a child form, I have data from a database that populates related lables upon a selected index change from a combobox.
What I'd like to do is allow the user to add the data that is populated to the array/structure, change the selected index/data and add the newly populated date to the next index of the array/structure. This is what I have for that code:
Visual Basic:
Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click
aryOrder(intI).strArtist = cboArtists.Text
aryOrder(intI).strTitle = lblTitle.Text
aryOrder(intI).intTracks = lblTracks.Text
aryOrder(intI).decPrice = decPrice
intI += 1
End Sub
In the execution, when I click on the Add button, I get the following error:
An unhandled exception of type 'System.NullReferenceException' occurred in Kens Music.exe
Additional information: Object reference not set to an instance of an object.
Do I need to declare an instance of the structure/array before i I can use it?
If anyone can help me, that would be super.
Thanks.