Click here to Skip to main content
15,890,527 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi How to clear datagrid values in Windows application after save button clcked


dgv.rows.clear();
not working

pls help me
Posted
Updated 18-Apr-13 22:55pm
v2
Comments
Maciej Los 19-Apr-13 4:01am    
What have you done so far?
Where are you stuck?
Amarender1479 19-Apr-13 4:09am    
datagridview1.rows.clear(); am using methode bt not cannot clear this
Maciej Los 19-Apr-13 4:58am    
Did you see my answer?
Thomas Barbare 19-Apr-13 6:43am    
Your datagridview seems to be bound to a datasource, so you have to unassign the datasource or clear the datasource.

Change the datasource for this DataGridView for null or empty datatable.

C#
DataGridView1.DataSource = null;


More at: http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.datasource%28v=vs.85%29.aspx[^]
 
Share this answer
 
This will clear your grid

DataGridView1.DataSource = null;
DataGridView1.DataBind()
 
Share this answer
 
http://stackoverflow.com/questions/11561680/deleting-all-the-data-from-a-datagridview
 
Share this answer
 

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