D
Dean Slindee
I want to build an array on the fly in code with a parameter passed for the
number of elements in the array. I am trying to do this by looping, but
get an array with just one element in the end.
Can this be done my way or some other way?
Dim idx As Integer
Dim cnt As Integer = 5 'parm for # of elements
Dim picArray As PictureBox()
For idx = 0 To cnt - 1
picArray = New PictureBox() {New PictureBox} 'one element
picArray(idx) = New PictureBox() {New PictureBox} 'bad syntax
Next
idx = picArray.GetUpperBound(0)
'when above works, then do this:
For idx = 0 To cnt - 1
picArray(idx).BorderStyle = BorderStyle.FixedSingle
picArray(idx).BackColor = SystemColors.Control
picArray(idx).Height = size
picArray(idx).Width = size
Next
Thanks,
Dean Slindee
number of elements in the array. I am trying to do this by looping, but
get an array with just one element in the end.
Can this be done my way or some other way?
Dim idx As Integer
Dim cnt As Integer = 5 'parm for # of elements
Dim picArray As PictureBox()
For idx = 0 To cnt - 1
picArray = New PictureBox() {New PictureBox} 'one element
picArray(idx) = New PictureBox() {New PictureBox} 'bad syntax
Next
idx = picArray.GetUpperBound(0)
'when above works, then do this:
For idx = 0 To cnt - 1
picArray(idx).BorderStyle = BorderStyle.FixedSingle
picArray(idx).BackColor = SystemColors.Control
picArray(idx).Height = size
picArray(idx).Width = size
Next
Thanks,
Dean Slindee