## Help with VB code

I am doing matrix multiplication and connectivity.
I think that I got the multiplication working but I can't get the connectivity correct. PLease help me.
Here is the code in which I have trouble.

Private Sub cmdCalButton_Click()
p = 0
q = 0

'flag = ""

'Take elements of A in the array aay

For ro = 0 To 3

For co = 0 To 3

If A(q) = "" Then

aay(ro, co) = 0

Else

aay(ro, co) = Int(A(q))

End If

q = q + 1

Next

p = p + 4

q = p

Next

p = 0

q = 0

'Take all the elements of B in array bee

For ro = 0 To 3

For co = 0 To 3

If B(q) = "" Then

bee(ro, co) = 0

Else

bee(ro, co) = Int(B(q))

End If

q = q + 1

Next

p = p + 4

q = p

Next

'Take all the elements of C in array see

p = 0

q = 0

For ro = 0 To 3

For co = 0 To 3

If C(q) = "" Then

see(ro, co) = 0

Else

see(ro, co) = Int(C(q))

End If

q = q + 1

Next

p = p + 4

q = p

Next

Debug.Print "A***************"

For ro = 0 To 3 'Check for successful fill-up

For co = 0 To 3

Debug.Print "aay(" & ro & "," & co & ") = " & aay(ro, co)

Next

Next

Debug.Print "B***************"

For ro = 0 To 3 'Check for successful fill-up

For co = 0 To 3

Debug.Print "bee(" & ro & "," & co & ") = " & bee(ro, co)

Next

Next

Debug.Print "C********************"

Debug.Print "A***************"

For ro = 0 To 3 'Check for successful fill-up

For co = 0 To 3

Debug.Print "see(" & ro & "," & co & ") = " & see(ro, co)

Next

Next

'Processing logic
'Assign a dynamic matrix C

If Option1(11).Value = True Then

If (Right(cmbOrderOfA, 1) = Left(cmbOrderOfA, 1)) Then

For p = 0 To 3

For q = 0 To 3

temp(p, q) = 0

For ctr = 0 To 3

temp(p, q) = temp(p, q) + aay(p, ctr) * aay(ctr, q)

Next

Next

Next

If (Left(cmbOrderOfA, 1) = Right(cmbOrderOfA, 1)) Then

For p = 0 To 3

For q = 0 To 3

dee(p, q) = 0

For ctr = 0 To 3

dee(p, q) = dee(p, q) + temp(p, ctr) * aay(ctr, q)

Next

Next

Next

i = 0

For ro = 0 To 3

For co = 0 To 3

B(i).Text = dee(ro, co)

i = i + 1

Next

Next

Call All_Visible_B

Call All_Visible_B

ro = Int(Left((cmbOrderOfA.Text), 1))

co = Int(Right((cmbOrderOfA.Text), 1))

If (ro <> 4) Then

For i = (ro * 4) To 15

B(i).Visible = False

'D(i). = ""

Next

End If

q = co

If (co <> 4) Then

For i = co To 3

For p = 1 To 4

B(q).Visible = False

q = q + 4

Next

co = co + 1

Next
End If
End If
End If
End If

If Option1(0).Value = True Then

If (Right(cmbOrderOfA, 1) = Left(cmbOrderOfA, 1)) Then

For p = 0 To 3

For q = 0 To 3

temp(p, q) = 0

For ctr = 0 To 3

temp(p, q) = temp(p, q) + aay(p, ctr) * aay(ctr, q)

Next

Next

Next

If (Left(cmbOrderOfA, 1) = Right(cmbOrderOfA, 1)) Then

For p = 0 To 3

For q = 0 To 3

dee(p, q) = 0

For ctr = 0 To 3

dee(p, q) = dee(p, q) + temp(p, ctr) * aay(ctr, q) * aay(ctr, q)

Next

Next

Next

i = 0

For ro = 0 To 3

For co = 0 To 3

C(i).Text = dee(ro, co)

i = i + 1

Next

Next

Call All_Visible_c

Call All_Visible_c

ro = Int(Left((cmbOrderOfA.Text), 1))

co = Int(Right((cmbOrderOfA.Text), 1))

If (ro <> 4) Then

For i = (ro * 4) To 15

C(i).Visible = False

Next

End If

q = co

If (co <> 4) Then

For i = co To 3

For p = 1 To 4

C(q).Visible = False

q = q + 4

Next

co = co + 1

Next
End If
End If
End If
End If

If Option1(2).Value = True Then

If (Right(cmbOrderOfA, 1) = Left(cmbOrderOfB, 1)) Then

For p = 0 To 3

For q = 0 To 3

dee(p, q) = 0

For ctr = 0 To 3

dee(p, q) = dee(p, q) + temp(p, ctr) + aay(ctr, q) + bee(ctr, q)

Next

Next

Next

If (Left(cmbOrderOfC, 1) = Right(cmbOrderOfA, 1)) Then

For p = 0 To 3

For q = 0 To 3

dee(p, q) = 0

For ctr = 0 To 3

dee(p, q) = dee(p, q) + temp(p, ctr) + see(ctr, q)
Next

Next

Next

i = 0

For ro = 0 To 3

For co = 0 To 3

D(i).Caption = dee(ro, co)

i = i + 1

Next

Next

Call All_Visible_D

Call All_Visible_D

ro = Int(Left((cmbOrderOfA.Text), 1))

co = Int(Right((cmbOrderOfB.Text), 1))

If (ro <> 4) Then

For i = (ro * 4) To 15

D(i).Visible = False

Next

End If

q = co

If (co <> 4) Then

For i = co To 3

For p = 1 To 4

D(q).Visible = False

q = q + 4

Next

co = co + 1