Empty a dataGrid

pcPirate

Regular
Joined
Aug 12, 2003
Messages
66
Location
Kuala Lumpur, M'sia
using C#,

I have a datagrid made on a windows form. When the form is loaded, the datagrid would be filled with data from a database, by adding DataGridTableStyle into the datagrid.

In the windows form, I also have a button called "Discard", which would clear all the information in the datagrid. Then, the user would be able to click on a browse button to select another set of data (in the same database table) to be display on the datagrid.

i) Can anyone advice? I've tried a lotta ways such as set datagrid.DataSource = null, but the data is actually still located in the datagrid.

Pls. advice and Thanks in advance.

pcPirate.
 
Quite simple, take an empty dataset (only containing the columns needed but no rows) and use this one as datasource.

Voca
 
Back
Top