Name: Fag 2010-11-23 18:37
I'm trying to code a matrix in visual basic. If you don't know what a matrix is, it's an array used in mathematics. Think of it like a grid consisting of x # of rows and y # of columns. Then you select the coordinates (x,y) and set a value.
So far in my program i have it so that the user can select the size of the matrix (x,y). But my problem is assigning the matrix to the size.
I have a dilemma because i need my string "MatrixA" to be outside of a a SUB category. But if i do that then when i reference the MatrixA, it can't make the connection.
When i create the string MatrixA inside the sub i'm working on it in, it is able to reference back to it just fine. Here is my major problem...
Sine i created MatrixA inside the SUB, every time it loops that SUB, it resets the value of MatrixA. You can see how this is problematic.
Example
First loop
SUBa
size = 2, 2
SUBb
Creats MatrixA and calls size from SubA
0, 1 = 3
(It does rows before colums)
| |3|
| | |
SECOND LOOP
Recreates MatrixA
SUBb
1, 1 = 4
| | |
| |4|
It cleared my previous assignment of 0, 1 = 3 because it recreated MatrixA.
Overview, I can't recall MatrixA outside of SUBb for some reason. But when i create MatrixA INSIDE SUBb, it recreates it each instance and makes it impossible to be of any use.
So far in my program i have it so that the user can select the size of the matrix (x,y). But my problem is assigning the matrix to the size.
I have a dilemma because i need my string "MatrixA" to be outside of a a SUB category. But if i do that then when i reference the MatrixA, it can't make the connection.
When i create the string MatrixA inside the sub i'm working on it in, it is able to reference back to it just fine. Here is my major problem...
Sine i created MatrixA inside the SUB, every time it loops that SUB, it resets the value of MatrixA. You can see how this is problematic.
Example
First loop
SUBa
size = 2, 2
SUBb
Creats MatrixA and calls size from SubA
0, 1 = 3
(It does rows before colums)
| |3|
| | |
SECOND LOOP
Recreates MatrixA
SUBb
1, 1 = 4
| | |
| |4|
It cleared my previous assignment of 0, 1 = 3 because it recreated MatrixA.
Overview, I can't recall MatrixA outside of SUBb for some reason. But when i create MatrixA INSIDE SUBb, it recreates it each instance and makes it impossible to be of any use.