Dears

Private Sub DataGridView1_CellLeave(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellLeave
If e.ColumnIndex = 0 And e.RowIndex = 0  Then
            MsgBox("this is first coulmn")
        End IfEnd Sub

IF cursor leaves column 0 and row 0 then it displays msgbox but
I want to check where column 0 and row 0 has value or empty

In case of empty cell it must display msg as
msgbox("this is empty cell")

Please help

Recommended Answers

All 3 Replies

What is the best datagridview event to use these codes

I want to check column 0 is empty or has some value

If e.ColumnIndex = 0 Then
            If DataGridView1.CurrentCell.Value = "" Then
                MsgBox("Empty Value")
            Else
                MsgBox("Not empty column")
            End If
        End If

Please help

It depends when you're trying to check the value. Please describe what you are doing in a little more detail.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.