none
Cannot clear this list (datagrid.Rows.Clear)

    Question

  • Hi,
    I have a datagrid object that is filled with data when the app starts. That works fine but when I coded Refresh action, I would need to erase datagrid object so I call:

    this

     

    .dataGridView1.Rows.Clear();

    this

     

    .dataGridView1.Columns.Clear();

    While Columns.Clear works fine, Rows.Clean always throws an exception that the list cannot be cleared. I dont know why.
    Thank you!

    Friday, October 2, 2009 10:22 AM

Answers

  • Why do you need to clear the rows setting a new datasource do not append new records.

    You can set new datasource
    or
    set datasource to null.
    • Marked as answer by Blizna Friday, October 2, 2009 10:48 AM
    Friday, October 2, 2009 10:38 AM

All replies