viola123
asked on
How to refresh a DataGridView?
All,
i have a datagridview, the data source of it is a List. what i want to do are:
1. Add new data to the list
2. bind the list to dataGridView
3. refresh the dataGridView
example:
lstGrpMaster.Add(Master1);
dataGridViewMaster.DataSou rce = _lstGrpMaster;
dataGridViewMaster.Refresh ();
the above code does not work. Do you have any idea?
thanks a lot
viola
i have a datagridview, the data source of it is a List. what i want to do are:
1. Add new data to the list
2. bind the list to dataGridView
3. refresh the dataGridView
example:
lstGrpMaster.Add(Master1);
dataGridViewMaster.DataSou
dataGridViewMaster.Refresh
the above code does not work. Do you have any idea?
thanks a lot
viola
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Forgot to ask, is this windows or web?
I assumed it's windows because windows grid is called dataGridView and the web GridView have no Refresh method.
I assumed it's windows because windows grid is called dataGridView and the web GridView have no Refresh method.
ASKER
All,
thanks. i figured it out, you have to set the datasource to Null first and then assign the datasource again.
AlexCode: it is windows application.
thanks. i figured it out, you have to set the datasource to Null first and then assign the datasource again.
AlexCode: it is windows application.
nevermind, stupid question. I had the dataset size set incorreclty. Thanks
Instead of dataGridViewMaster.Refresh
Regards,
Wayne