Using Array.GetLength() ?
Hi all, i am trying to write a little code that goes through a loop while a count is less than a 2d array's (0th) postion,
here is my code
string[,] Products;
DataRow[] foundRows = myDataTable.Select();
for (int i = 0; i < foundRows.Count(); i++)
{
int thecount = 0;
bool FoundResult = false;
while (thecount < Products.GetLength(0))
{
if (Products[i, 0] == foundRows[i][3].ToString())
{
int tempint = int.Parse(Products[thecount, 1].ToString());
tempint++;
Products[thecount, 1] = tempint.ToString();
FoundResult = true;
break;
}
else
{
}
thecount++;
}
This all looks good to me, but when i run the code it throws up the error
"Error 1 Use of unassigned local variable 'Products'
The bit underlined where its happening... any ideas ?
the array needs to be dynamic.. since i add to it as its searching
Thanks in advance..