Hi Experts
I m using vb .net2008. I want to skip read-only columns, for this I use these codes
But their some error, how is it possible????

Private Sub DataGridView1_CellEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellEnter
        Dim y As Integer = DataGridView1.CurrentCellAddress.Y
        Dim x As Integer = DataGridView1.CurrentCellAddress.X
        Dim dg_cr As Integer = DataGridView1.RowCount - 1

        If DataGridView1.CurrentCell.ReadOnly = True Then
            Dim last_s_row As Integer
            last_s_row = DataGridView1.RowCount - 1
            DataGridView1.CurrentCell = DataGridView1.Item(1, last_s_row)
        End If
    End Sub

Recommended Answers

All 3 Replies

What is the error message?

The error massage is "Operation is not valid because it results in a reentrant call to the SetCurrentCellAddressCore function."

According to this article, the selection of a cell in the DataGridView has turned into an infinite loop, which promply causes the crash.

Probably because you are selecting a new cell from inside one of the cell selection events.

I have no solution for you though.

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.