Dynamic Arrays
*
Public Class Form1
Public DynArray() As Integer
Public rnd As New Random


Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
ReDim DynArray(9)
PopulateArray()
End Sub

Private Sub PopulateArray()
For i = 0 To DynArray.count - 1
DynArray(i) = rnd.Next(1, 101)
Next
Label.1Text = DynArray.count
ListBox1.Items.Clear()
Array.ForEach(DynArray, New Action(Of Integer)(Sub(x) ListBox1.itmes.add(x)))
End Sub

Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click
ReDim Preserve DynArray(DynArray.count + 9)
PopulateArray()
End Sub

Private Sub Button3_Click(sender As System.Object, e As System.EventArgs) Handles Button3.Click
ReDim XYArray(9, 9)
For x = 0 To 9
For y = 0 To 9
XYArray(x, y) = rnd.Next(1, 101)
Next
Next
msbbox(XYArray(3, 7))
End Sub
End Class

이 게시물을

공유하기

SEARCH

MENU NAVIGATION