Click here to Skip to main content
16,018,525 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello Have ListBox.Items.Clear() analog for dataGridView.
Because I have problem with duplicate records when call dataGrid twice.
Posted
Comments
[no name] 23-Aug-12 11:48am    
dataGridView1.Rows.Clear()?
kespinko 23-Aug-12 12:30pm    
not working . Give Error :
Cannot clear this list.

1 solution

Wes is right. You can also set the DataSource to be null and rebind, I believe. Are you using the datasource property, because it sounds like you are not, setting the datasource and calling databind will show your new data and remove the old.
 
Share this answer
 
Comments
kespinko 23-Aug-12 11:58am    
Yes I want show only new data and remove the old but dgView.DataSource = null
does not working
Christian Graus 23-Aug-12 12:05pm    
Did you call DataBind() ?
kespinko 23-Aug-12 12:10pm    
i think i don't . How I should call dataBind()?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900