如果table或datagridview中的一个数据为空,我将它填为其他值怎么做
我用过 if (dataGridView1.Rows[0].Cells[0].Value.ToString().Length <1)
 if (dataGridView1.Rows[0].Cells[0].Value.ToString()=="" )
if (dataGridView1.Rows[0].Cells[0].Value.ToString()==null )
都无效

解决方案 »

  1.   

    试试判断 dataGridView1.Rows[0].Cells[0].Text==""
      

  2.   

    if(dataGridView1.[0].Cells[0].Text.Equals(""))
    {
        dataGridView1.[0].Cells[0].Text="test";
    }
      

  3.   

    if(dataGridView1.Rows[0].Cells[0].Text.Equals("")) 

        dataGridView1.Rows[0].Cells[0].Text="test"; 
    }
      

  4.   

    if (datatable1.Row[0][0] == DBNull)
    {
        datatable1.Row[0][0] = "test";
    }