dataGridView1.CurrentRow.Cells[6].Value.ToString()的值無效或為空值

解决方案 »

  1.   

    dataGridView1.CurrentRow.Cells[6].Value.ToString()
    这句有问题,没取到数据,确定索引对不对?
      

  2.   

    可能是输入的时间格式不对。用selectedRows试试。
    例:
    for (int i = 0; i < this.dataGridView.SelectedRows.Count; i++)
    {
        this.dataGridView.SelectedRows[i].Cells["NRT"].Value = "Yes";
        this.dataGridView.SelectedRows[i].Cells["Online"].Value = "Yes";
    }
      

  3.   

    跟踪下this.dataGridView1.CurrentRow.Cells[6].Value.ToString()出来的是个什么东西。
    格式对吗?
    “索引0处”意思是系统认为这个字符串从第一个字符开始就是非法的。
      

  4.   

    this.dataGridView1.CurrentRow.Cells[6].Value.ToString()
    检查这个数据。或者this.dataGridView1.CurrentRow.Cells[6].Value.ToString().Trim();