private void Tinh(object sender) { DevExpress.XtraGrid.Views.Grid.GridView Gv = (GridView)sender; i = 0; // int i is a global variable used to browse the ith record of GridView // bStop is the global variable bool while (i < Gv.RowCount && bStop)//Running faulty loop next record { try { // While i have not stopped yet, the East and the next run while (i < Gv.RowCount && bStop)// Running the main loop { if (condition) { //do somthing } else { //do somthing } i++; } // Running the main loop } catch (Exception ex) { i++; Debug.Print("error: " + ex.Message); } }// Repeat loop faulty next record } Edited 8 Years Ago by Dong Trien Lam