|
-
Mar 31st, 2002, 05:41 AM
#1
Thread Starter
Addicted Member
Setting a new length for an array without having to redim it....
-
Mar 31st, 2002, 06:18 AM
#2
Frenzied Member
-
Mar 31st, 2002, 06:58 AM
#3
Thread Starter
Addicted Member
So making a new array, loading stuff into there and then move it to the first array is the only way?
-
Mar 31st, 2002, 09:22 AM
#4
Frenzied Member
hmm what about Redim preserve?
this will keep the contents of the array while changing it's size.
Jop - validweb.nl
Alcohol doesn't solve any problems, but then again, neither does milk.
-
Mar 31st, 2002, 11:09 AM
#5
Frenzied Member
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:
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
Dont gain the world and lose your soul
-
Mar 31st, 2002, 03:55 PM
#6
Thread Starter
Addicted Member
Thnx, i already did the first part but i didn't relize i could do it this way
Last edited by JpEgy; Mar 31st, 2002 at 07:05 PM.
JpEgy
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|