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
}

Recommended Answers

All 4 Replies

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

where is the differance?
Thanks

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

Thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.