>>i'm trying to do is define a two-dimentional array with the 2nd dimention as an undefined.
See if this helps regarding the 2D Array.
Public Class Form1
Private x(6, 0) As String
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
x(0, 0) = "test"
MsgBox(x(0, 0))
x(1, 0) = "test again"
MsgBox(x(1, 0))
End Sub
End Class
codeorder
Posting Virtuoso
1,913 posts since Aug 2010
Reputation Points: 255
Solved Threads: 384
Try Private x(6, 5) As String and that should give you plenty more Indexes inside the bounds of the array.
codeorder
Posting Virtuoso
1,913 posts since Aug 2010
Reputation Points: 255
Solved Threads: 384
Public Class Form1
Private x(6, 0) As String
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
reDimAndPreserveArray(1)
MsgBox("x(" & x.GetUpperBound(0) & ", " & x.GetUpperBound(1) & ")") '// FOR.TESTING.
End Sub
Private Sub reDimAndPreserveArray(ByVal iNumberOfArraysToAdd As Integer)
Static iCurrentNumberOfArrays As Integer = 0
iCurrentNumberOfArrays += iNumberOfArraysToAdd
ReDim Preserve x(6, iCurrentNumberOfArrays)
End Sub
End Class
Click the btn a few times for testing and anytime you need to add more arrays, just use that Sub and specify the amount of arrays to add.
.btw: it will Preserve all the previous values for the array.
Hope this helps.:)
codeorder
Posting Virtuoso
1,913 posts since Aug 2010
Reputation Points: 255
Solved Threads: 384
Solving the problem caused another. Dam.n you God!:D
I personally have no idea how to save a 2D array to a file without having to loop thru all the arrays.
You should start a thread regarding this new issue and hopefully someone will be able to shine some light on this matter.
codeorder
Posting Virtuoso
1,913 posts since Aug 2010
Reputation Points: 255
Solved Threads: 384