Click here to Skip to main content
15,889,378 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
how to clear certain column data from datagridview in c#.net (windows)



thanksss
Posted
Updated 29-Jun-15 19:57pm
v2
Comments
[no name] 30-Jun-15 2:16am    
You need to elaborate more on the action you want to achieve(clear column data for one row or all rows of the grid). As the problem you asked is easily available on Google. Just try googling.

Create one data table and read the value which you want and put it another table and bind this table to data grid view.

which column want to empty value then put it any value in that.

DataTable dt = new DataTable();
DataRow Row  = dt.NewRow();
for (int f = 0; f < Cols; f++)
{
    Row[f] = Fields[f];
}
dt.Rows.Add(Row);
 
Share this answer
 
You can simple use Loop to clear the column value from DataGridView
foreach (DataGridViewRow myRow in dataGridView1.Rows) 
{
    myRow.Cells[0].Value = null; // assuming you want to clear the first column
}
 
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