I have the following code structure:
[CODE]
bool bStop = true;
int RowCount = 65000;
private void btnRun_Click(object sender, EventArgs e)
{
int i = 0;
//int iErr;
while (i < dataGridView1.Rows.Count - 1 && bStop)//Loop 1
{
while (i < dataGridView1.Rows.Count - 1 && bStop)// Loop 2
{
try
{
if (i > 0) dataGridView1.Rows[i-1].Selected = false;
dataGridView1.Rows[i].Selected = true;
dataGridView1["ROWS", i].Value = "Processing...";
System.Windows.Forms.Application.DoEvents();
Thread.Sleep(1000);
Debug.Print("are in Try and i: " + i);
//if (chkErr.Checked == true)
//{ iErr = "E"; }
}
catch (Exception ex)
{
Debug.Print("are in Catch and i: " + i + " ex: " + ex.Message);
//If an error occurs this place, why not escape to run i next catch ?
}
i++;
}// Loop 1
}//Loop 2
}
[/CODE]

Nilesh ShahRank #42 · 34.2K reputationPosted Feb 23, 2017, 6:43 AM EST
Dong Lam TrienRank #1,538 · 1K reputationPosted Feb 23, 2017, 5:00 PM EST
Bryian TanRank #396 · 6.3K reputationPosted Feb 23, 2017, 5:17 PM EST
Rafnas T PRank #280 · 8.8K reputationPosted Feb 23, 2017, 5:37 PM EST
Dong Lam TrienRank #1,538 · 1K reputationPosted Feb 23, 2017, 9:33 PM EST