Aminur Rahman
Aminur Rahman

Reputation: 410

DataGridView data is not displayed, but after selecting data it is displayed - C#

Screenshot:

enter image description here

I have created a DataGridView in windows forms application. i have bound data with DataTable. I get data but it is not displaying. When i select the row then it is visible.

grdPiDetails.DataSource = iDBUtility.GetDataTable("exp_imp_get_all_PI");

Upvotes: 0

Views: 67

Answers (2)

boop_the_snoot
boop_the_snoot

Reputation: 3257

This is happening probably because the DataGridViewCell has Foreground color set as White

Include this in your Form_Load event: [change myDGV with your DataGridView]

myDGV.RowsDefaultCellStyle.ForeColor = Color.Black;

If this won't fix your issue, try @Niraj's solution

Upvotes: 1

Niraj Rajpurohit
Niraj Rajpurohit

Reputation: 34

Try This :

First click on DataGridView -> Edit Column -> (Left Side) Select Column (Like First_Name) -> (Right Side) Set DataPropertyName (Like firstname).

Records Will Display.

Upvotes: 1

Related Questions