clearing a datagrid

G

Guest

Hello,
What is the best method of clearing a datagrid?
I'm having issues with it not 'resetting' when I want to repopulate it.
I usually design my datagrids using the .net toolbar/properties, but had to
create this one programmatically (so I could add comboboxes).
I've never had this problem before, but now, whenever I try to repopulate my
dataset, it keeps my original data, and adds the column headers as new rows.
It seems to me that I just need to 'empty' the datagrid, or clear it
completely before repopulating it.
Any advice?
TIA,
Amber
 
F

Frans Bouma [C# MVP]

amber said:
Hello,
What is the best method of clearing a datagrid?
I'm having issues with it not 'resetting' when I want to repopulate
it. I usually design my datagrids using the .net toolbar/properties,
but had to create this one programmatically (so I could add
comboboxes). I've never had this problem before, but now, whenever I
try to repopulate my dataset, it keeps my original data, and adds the
column headers as new rows. It seems to me that I just need to
'empty' the datagrid, or clear it completely before repopulating it.

clear the bound data containing object, like the bound datatable, then
the grid clears itself. Be sure the object implements IBindingList, so
the grid gets an event that the bound object is cleared. So a normal
ArrayList won't do.

FB

--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top