Home > Net >  DGV content is empty times wrong, System. Windows. Forms. DataGridViewCell. Value. Get returns null.
DGV content is empty times wrong, System. Windows. Forms. DataGridViewCell. Value. Get returns null.

Time:04-27

System. NullReferenceException: "the object reference not set to an instance of an object," System. Windows. Forms. DataGridViewCell. Value. Get returns null,

Under the guidance of the great god, how to deal with:

String beizhu;
If (the Convert. ToString (dataGridView1. Rows [I] Cells [" bz] Value. The ToString ())!="")
{
Beizhu=dataGridView1. Rows [I] Cells [" bz] Value. The ToString ();
}
The else
{
Beizhu="NULL".
}

CodePudding user response:

 
String beizhu;
If (dataGridView1. Rows [I] Cells [" bz] the Value!=null & amp; & DataGridView1. Rows [I] Cells [" bz] Value. The ToString ()!="")
{
Beizhu=dataGridView1. Rows [I] Cells [" bz] Value. The ToString ();
}
The else
{
Beizhu="NULL".
}
  •  Tags:  
  • C#
  • Related