如何判断DataGridView.CurrentRow.Cells(0)的值不为空值?
DataGridView.CurrentRow.Cells(0).Value <> NothingDataGridView.CurrentRow.Cells(0).Value <> DBNull.ValueDataGridView.CurrentRow.Cells(0).Value IsNot NothingDataGridView.CurrentRow.Cells(0).Value IsNot DBNull.Value'以上幾種寫法都不對,都報錯
If DataGridView.SelectedRows.Count > 0 Then If Not IsDBNull(DataGridView.CurrentRow.Cells("WID").Value) Then '…… End IfEnd If
[解决办法]
If DataGridView <> Nothing Then If DataGridView.CurrentRow <> Nothing Then If DataGridView.CurrentRow.Cells <> Nothing Then If DataGridView.CurrentRow.Cells(0) <> Nothing Then If DataGridView.CurrentRow.Cells(0).Value <> Nothing Then