I want to pass an array of arrays to another Form
String[] arrayOfStrings = new String[4];
arrayOfStrings[0] = td1stcolumn[];
arrayOfStrings[1] = td2ndcolumn[];
arrayOfStrings[2] = td3rdcolumn[];
arrayOfStrings[3] = td4thcolumn[];
string resultDialogString = ResultDialog.ShowBox(arrayOfStrings, "Result Page");
td1stcolumn, td2ndcolumn, td3rdcolumn and td4thcolumn are all String arrays
C# is expecting values in the [] for td…column
Signature of ResultDialog.ShowBox is
public static string ShowBox(string[] arrayOfMessages, string txtTitle)
but I can modify the signature. I just need to transfer the data from the
td1stcolumn, td2ndcolumn, td3rdcolumn and td4thcolumn
to the ResultDialog.Show method
Assuming you have declared your “td” variables like this:
Then you can assign these values to your
arrayOfStringslike this:You’ll also need to change the declaration for your string array to something like this:
or
Multi-Dimentional Array Documentation
Jagged Array Documentation
Example of a Jagged Array usage: