DataGridView.Clear()

前端 未结 19 1830
夕颜
夕颜 2020-12-02 20:01

Here comes the trouble. I want to delete all rows from datagridview. This how i add rows:

private void ReadCompleteCallback(object clientHandle, Opc.Da.ItemV         


        
相关标签:
19条回答
  • 2020-12-02 20:42

    I have this piece of code i hope it may help u.

    int numRows = dgbDatos.Rows.Count;    
    for (int i = 0; i < numRows; i++)
    {
        try
        {    
            int max = dgbDatos.Rows.Count - 1;
            dgbDatos.Rows.Remove(dgbDatos.Rows[max]);
    
        }
        catch (Exception exe)
        {
            MessageBox.Show("You can´t delete A row " + exe, "WTF",
            MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
    }
    
    0 讨论(0)
提交回复
热议问题