0

Hello there,
I have an array of 2 dimensional which i need to pass to a funtion,
but every time i try to send to the funcation "LoadScenario" it fails.

maybe my syntax is wrong,please take a look

Thanks Ahead

string[,] Vars = newstring[5,4];
 
 
Vars[0,1]="Calculos";
Vars[1,1]=" 1";
Vars[2,1]=" 2";
Vars[3,1]=" 3";
 
Vars[0,0]="General";
Vars[1,0]=" 4";
Vars[2,0]=" 5";
Vars[3,0]=" 5";
Vars[4,0]=" 6";
 
LoadScenario(Vars);
 
------------------------
privatevoid LoadScenario(string Vars1)
{
//do something
}
3
Contributors
4
Replies
6
Views
10 Years
Discussion Span
Last Post by kobi
0

string[,] Vars = newstring[5,4];


Vars[1,0]="Calculos";
Vars[1,1]=" 1";
Vars[1,2]=" 2";
Vars[1,3]=" 3";

Vars[0,0]="General";
Vars[0,1]=" 4";
Vars[0,2]=" 5";
Vars[0,3]=" 5";
Vars[0,4]=" 6";

LoadScenario(Vars);
try this

0

he probably left off his method declaration

private void LoadScenario( string[,] Vars ) {
}
 
//but if you only need one portion of the string in vars
 
private void LoadScenario(string Vars) {}
 
//then call like this..
//assume we are inside of a class at this point
 
LoadScenario(vars[x,y]);
 
//where x is some int within bounds
//where y is some int within bounds
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.