How?
How?
can't
So making a new array, loading stuff into there and then move it to the first array is the only way?
hmm what about Redim preserve?
this will keep the contents of the array while changing it's size.
You dont have to do that. If you need a dynamic array, look in the collection class.
Look up ArrayList. Its perfect for what you want to do. The object that you want to declare as an array, you dont have to do that.
Here is an example
'Structure
VB Code:
Structure SCD Public cdTitle As String Public cdGenre As String Public cdIsbn As Long Public cdTracks As Integer Public cdArtist As String End Structure
'declaring an arraylist
VB Code:
Public cdArray As New ArrayList()
'declaring a new cd from the structure SCD
VB Code:
Public newCD As SCD
VB Code:
Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click 'each time button is clicked the structure is filed from the text boxes, then the newCD is added to the cdArray arraylist With newCD .cdTitle = cdTitle.Text .cdGenre = cdGenre.Text .cdIsbn = cdIsbn.Text .cdArtist = cdArtist.Text .cdTracks = cdTracks.Text End With ccdArray.Add(newCD) End Sub
Hoped that helped. Look up ArrayList and you should find some usefull information
Thnx, i already did the first part but i didn't relize i could do it this way :D