Aminur Rahman Aminur Rahman - 11 months ago 49
C# Question

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");

Answer Source

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download