The Random generator works fine. What I have a problem with is adding the rows and columns.
Array
0,0 0,1 0,2 = row total
1,0 1,1 1,2 = row total
2,0 2,1 2,2 = row total
= = =
col total coltotal col total
also add 0,0 1,1 2,2 diagonaly
Private Sub BtnFillArray_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnFillArray.Click
Dim Row As Integer
Dim Col As Integer
Dim Number As Integer
Number = RandomNumber.Next(RandomNumberLimit)
For Row = 0 To 2
For Col = 0 To 2
TwoDim(Row, Col) = Number
Number += 1
Next Col
Next Row
Lbl3x3ArrCell00.Text = CStr(RandomNumber.Next(RandomNumberLimit))
Lbl3x3ArrCell01.Text = CStr(RandomNumber.Next(RandomNumberLimit))
Lbl3x3ArrCell02.Text = CStr(RandomNumber.Next(RandomNumberLimit))
Lbl3x3ArrCell10.Text = CStr(RandomNumber.Next(RandomNumberLimit))
Lbl3x3ArrCell11.Text = CStr(RandomNumber.Next(RandomNumberLimit))
Lbl3x3ArrCell12.Text = CStr(RandomNumber.Next(RandomNumberLimit))
Lbl3x3ArrCell20.Text = CStr(RandomNumber.Next(RandomNumberLimit))
Lbl3x3ArrCell21.Text = CStr(RandomNumber.Next(RandomNumberLimit))
Lbl3x3ArrCell22.Text = CStr(RandomNumber.Next(RandomNumberLimit))
LblGBRowR1r0.Text = "" (holds results of 0,0 0,1 0,2)
LblGBRowR1r1.Text = "" (holds results of 1,0 1,1 1,2)
LblGBRowR1r2.Text = "" (holds results of 2,0 2,1 2,2)
LblGBColC1c0.Text = "" (holds results of 0,0 1,0 2,0)
LblGBColC1c1.Text = "" (holds results of 0,1 1,1 2,1)
LblGBColC1c2.Text = "" (holds results of 0,2 2,1 2,2)
LblGBDiaL.Text = "" (holds results of 0,0 1,1 2,2)
LblGBDiaR.Text = "" (holds results of 02 1,1 2,0)
End Sub
Tried this below but results were faulty (worked but wrong answers)
(Example Below)
Private Sub BtnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnAdd.Click
LblGBRowR1r0.Text = Convert.ToString(CInt(((TwoDim(0, 2) + TwoDim(0, 1) + TwoDim(0, 0)))))
LblGBColC1c0.Text = Convert.ToString(CInt(((TwoDim(0, 0) + TwoDim(1, 0) + TwoDim(2, 0)))))
LblGBDiaL.Text = Convert.ToString(CInt(((TwoDim(0, 0) + TwoDim(1, 1) + TwoDim(2, 2)))))
Just need a simple method to add Thanks