Quantcast
Channel: Windows Forms Data Controls and Databinding forum
Viewing all articles
Browse latest Browse all 2535

DataGridView remove blank cells

$
0
0

Hi All,
Good Morning !!
I have a list which with file names as values. I would need to populate the List into a gridview. But the cell formatting is the problem. I want to fill in the GridView column wise, not row wise. In other words, there should be no empty cells shown when there is no value on the cell.

DataTable ReportList = new DataTable(); ReportList.Columns.Add("Found List"); ReportList.Columns.Add("NotFound List");

ReportList.Columns.Add("Hash Mismatch");

Here I am feeding the DataTable. 

#  This is FOUND List(Column1), so I leave the other two columns empty.

 ReportList.Rows.Add(output.FullName,null,null);

# This is not found list (column2), so I leave the other two columns empty.

ReportList.Rows.Add(null,output.FullName,null);


# This is HashMismtach list (Column3), so I leave the other two columns empty.

    ReportList.Rows.Add(null,null,output.FullName);

Giving the DataTable as input to Datagridview.

dataGridView1.DataSource = ReportList;


Here is my output. But there are many empty cells, (as i am not supplying value for the corresponding columns in those rows). But How do i get rid of the empty cells  or what mistake i am doing in populating the Data Table or Grid View.

I expect my output to be like this nicely ordered without any blank cells.
Can you please help....?


- Neuronring




Viewing all articles
Browse latest Browse all 2535

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>