Binding Esnasında DataGridView Rows Clear

by Eravse on Ağustos 9, 2009

Merhabalar main formda bulunan bır data gridi otomatik olarak bind eden bir fonksiyon için kullanılabilir.

//usage : 

//ClearRows(dataGridView1);

public void ClearRows(DataGridView dg)
        {
            int rowCount = dg.Rows.Count;
            if (rowCount != 0 | rowCount != -1)
            {

                for (int i = 0; i < rowCount; i++)
                {

                    dg.Rows.RemoveAt(i);

                    --rowCount;
                }
            }

            }

Leave your comment

Required.

Required. Not published.

If you have one.