Mehmet Fatih

Mehmet Fatih

  • 748
  • 939
  • 41.1k

My code block is working very slow.

Aug 3 2023 10:08 PM

I'm trying to batch record using windows form. But When I click button to save, it works very slowly especially in this code block. Do you have a solution?

int i = 0;
    List<int> ChkedRow = new List<int>();

    if (dataGridView1.Rows.Count > 0)

        for (i = 0; i <= dataGridView1.RowCount - 1; i++)
        {
            if (Convert.ToBoolean(dataGridView1.Rows[i].Cells["oid"].Value) == true)
            {
                ChkedRow.Add(i);
            }
        }
    if (ChkedRow.Count == 0)
    {
        MessageBox.Show("Geziye katilacak ögrenci seçiminde bulunmadiniz!");
        return;
    }

 


Answers (4)