I have created a method that is looking at a datagrid and is trying to return the values of each column so that is can be used in various other places.
I started making it as below but have run into the problem that a tuple can only hold 8 values (i have 16 to hold in total.
Is there another way to create a method that would return more than 8 values and if so how do you then use the returned values in other parts of my code?
public Tuple<string,string,string,string,string,string,string,string> CurrentSelectedRecord()
{
//Method to find current selected Records
try
{
int rowIndex = dataGridView1.CurrentCell.RowIndex;
string enquiryIDString = Convert.ToString(dataGridView1.Rows[rowIndex].Cells[0].Value);
string clientString = Convert.ToString(dataGridView1.Rows[rowIndex].Cells[4].Value);
string contractManagerString = Convert.ToString(dataGridView1.Rows[rowIndex].Cells[5].Value);
string receivedDateString = Convert.ToString(dataGridView1.Rows[rowIndex].Cells[1].Value);
string requiredDateString = Convert.ToString(dataGridView1.Rows[rowIndex].Cells[2].Value);
string completeDateString = Convert.ToString(dataGridView1.Rows[rowIndex].Cells[3].Value);
string descriptionString = Convert.ToString(dataGridView1.Rows[rowIndex].Cells[6].Value);
string actionString = Convert.ToString(dataGridView1.Rows[rowIndex].Cells[7].Value);
var tuple = new Tuple<string, string, string, string,string,string,string,string>(enquiryIDString, clientString, contractManagerString, receivedDateString, requiredDateString, completeDateString,descriptionString,actionString);
return tuple;
}
catch
{
var tuple = new Tuple<string, string, string, string,string,string,string,string>("", "", "", "", "","","","");
return tuple;
}
}
I tired the above code but it errored when i got to 8 variables.