Clearing A Datagrid

  • Thread starter Thread starter Ed Bick
  • Start date Start date
E

Ed Bick

I am binding a datagrid to SQL Adapter.

I am wanting to clear it out and populate with a different data set based on
user action. I can not seem to find the equivalent to a VB6 Clear method.

Can anyone please help me with this, I'm sure very simple task.

Thanks
 
Ed,
You do not clear the DataGrid itself per se, you clear & repopulate the
underlying DataTable, or you replace the DataTable with a new DataTable.

Hope this helps
Jay
 
Like Jay mentions, call DataTable.Clear which will clear the underlying
table and then you can repopulate it. However, if you may need the data
again, then just rebind it.
 
Hello

First clear the datatable and then :

DataGrid1.DataSource = Nothing

Kind Regards
Jorge
 

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

Datatable clear 4
clear datagrid 1
DataGrid Clear after formating 1
Cancel/Clear Event Queue 5
Rows in Datagrid 12
Passing datagridview from form to class 5
RemoveRowsFromDataTable\DataGrid 1
Datagrid clear 3

Back
Top