Lan Solo
Member
Ok, my verbiage might not be right on the money (cuz Im a Newbie) but let me try to explain.
My school project requires that we declare a data table as a Global Integer Array. The form menu gives the user options to either sum or average the rows and columns and then display the results in a message box.
I am having trouble determining the subs or variables that will be used when the click event occurs. Here is some code from the project. If anyone has any suggestions or can see where I am messing up, that would be great. I cant seem to get the desired results to display.
R is for Row, C is for Column, X is the incremental variable I want to attach to str, so each loop will generate a new total.
So - One thing I cannot get it to do, my strX is the Result and the logic is failing.
How do I get
My school project requires that we declare a data table as a Global Integer Array. The form menu gives the user options to either sum or average the rows and columns and then display the results in a message box.
I am having trouble determining the subs or variables that will be used when the click event occurs. Here is some code from the project. If anyone has any suggestions or can see where I am messing up, that would be great. I cant seem to get the desired results to display.
Code:
Dim gintTable(,) = {{5, 7, 3, 9, 12}, {4, 8, 9, 13, 4}, {0, -1, -7, 13, 8}, {4, 4, 4, 4, 0}}
Dim intRowSum As Integer
Dim C As Integer
Dim R As Integer
Dim X As Integer
Dim IntSum
Dim strX As String
Dim ControlChar
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub btnRowSum_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRowSum.Click
For R = 0 To 3
For X = 1 To 4
For C = 0 To 4
IntSum += gintTable(R, C)
Next C
strX = IntSum
Next X
Next R
End Sub
R is for Row, C is for Column, X is the incremental variable I want to attach to str, so each loop will generate a new total.
So - One thing I cannot get it to do, my strX is the Result and the logic is failing.
How do I get