Given the following semi-code:
string[] MachineNames = new String[#ofMachines];
object[,] objectArray = new object[#ofSettings, #ofMachines];
int iSettingIndex = 0;
foreach (Setting in Settings)
{
for (int iMachineIndex = 0; iMachineIndex < #ofMachines; iMachineIndex++)
{
MachineNames[iMachineIndex] = getName(iMachineIndex);
objectArray[iSettingIndex, iMachineIndex] = getValue(iMachineIndex, strPath, strKey);
}
iSettingIndex++;
}
This will generate a 2Dimension Object Array, which would resemble something like:
Index 1 2 3
1 X Y Z
2 X Y Z
3 X Y Z
Where X,Y, and Z are the values for each setting on each Robot
My goal is to take this code and overlay it all in a Datagrid of some kind.
This requires 2 changes:
a) I need to add a Row0 [for the actual Machine names and not just the index] and a Column0 [for the actual Setting name (path+key) and not just the index]
b) I need to somehow set this 2 dimensional Object Array as the datasource for my Datagrid [when I do it directly C# gives me an error stating that: An unhandled exception of type 'System.ArgumentException' occurred in mscorlib.dll Additional information: Array was not a one-dimensional array.]
The end results should look like [in a Datagrid of some kind, without the Index information]:
Index 1 2 3
1 X Robot1 Robot2
2 \\Path1\Key1 X Y
3 \\Path2\Key2 X Y
4 \\Path3\Key3 X Y
string[] MachineNames = new String[#ofMachines];
object[,] objectArray = new object[#ofSettings, #ofMachines];
int iSettingIndex = 0;
foreach (Setting in Settings)
{
for (int iMachineIndex = 0; iMachineIndex < #ofMachines; iMachineIndex++)
{
MachineNames[iMachineIndex] = getName(iMachineIndex);
objectArray[iSettingIndex, iMachineIndex] = getValue(iMachineIndex, strPath, strKey);
}
iSettingIndex++;
}
This will generate a 2Dimension Object Array, which would resemble something like:
Index 1 2 3
1 X Y Z
2 X Y Z
3 X Y Z
Where X,Y, and Z are the values for each setting on each Robot
My goal is to take this code and overlay it all in a Datagrid of some kind.
This requires 2 changes:
a) I need to add a Row0 [for the actual Machine names and not just the index] and a Column0 [for the actual Setting name (path+key) and not just the index]
b) I need to somehow set this 2 dimensional Object Array as the datasource for my Datagrid [when I do it directly C# gives me an error stating that: An unhandled exception of type 'System.ArgumentException' occurred in mscorlib.dll Additional information: Array was not a one-dimensional array.]
The end results should look like [in a Datagrid of some kind, without the Index information]:
Index 1 2 3
1 X Robot1 Robot2
2 \\Path1\Key1 X Y
3 \\Path2\Key2 X Y
4 \\Path3\Key3 X Y