65.9K
CodeProject is changing. Read more.
Home

Delete Column in DataGridView

starIcon
emptyStarIcon
starIcon
emptyStarIconemptyStarIconemptyStarIcon

1.33/5 (3 votes)

Nov 25, 2015

CPOL
viewsIcon

8272

How to Delete Columns in a DataGridView

Introduction

This Article show you, how you can delete the Columns in a Datagridview 

Background

I had search long time to know how to clear the Columns in a DataGridView but i had not found some solution

Using the code

DataTable newTable = new DataTable("TEST");
DataTable.ReadXML("TEST.xml");
dataTablefromYesterday.Rows.OfType<DataRow>().ToList().ForEach(r =>
    {
        r["Gesamtstunden"] = DBNull.Value;
        r["Anfangszeit"] = DBNull.Value;
        r["Endzeit"] = DBNull.Value;
    });

C#

History

Keep a running update of any changes or improvements you've made here.