First off, here is my code.
Public Class Arrays_Loops
Dim defaultArray(,) As Integer = {{4, 12, 33}, {18, 12, 10}, {14, 29, 5}, {19, 25, 2}}
Dim newArray(,) As Integer
Private Sub Form_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
fillTextboxDefault()
End Sub
Private Sub fillTextboxDefault()
txt00.Text = defaultArray(0, 0)
txt01.Text = defaultArray(0, 1)
txt02.Text = defaultArray(0, 2)
txt10.Text = defaultArray(1, 0)
txt11.Text = defaultArray(1, 1)
txt12.Text = defaultArray(1, 2)
txt20.Text = defaultArray(2, 0)
txt21.Text = defaultArray(2, 1)
txt22.Text = defaultArray(2, 2)
txt30.Text = defaultArray(3, 0)
txt31.Text = defaultArray(3, 1)
txt32.Text = defaultArray(3, 2)
End Sub
Private Sub fillArray()
newArray(0, 0) = txt00.Text
newArray(0, 1) = txt01.Text
newArray(0, 2) = txt02.Text
newArray(1, 0) = txt10.Text
newArray(1, 1) = txt11.Text
newArray(1, 2) = txt12.Text
newArray(2, 0) = txt20.Text
newArray(2, 1) = txt21.Text
newArray(2, 2) = txt22.Text
newArray(3, 0) = txt30.Text
newArray(3, 1) = txt31.Text
newArray(3, 2) = txt32.Text
End Sub
End Class
What this code is supposed to do is replace the values in newArray with what the user inputs in the textboxes.
Now the question is, how can I call my fillArray() sub only when it is needed? Do I even need a private sub for this? I don't know how I can get the program to automaticly replace the values of newArray in real time, when the user changes the values in the textbox.
I hope you understand what I'm trying to explain, and that someone can help me with this.
Thanks.


Sign In
Create Account

Back to top









