Problem :Operation is not valid because it results in a reentrant call to the setcurrentcellAddressCore Function
I have a datagridview in VB2005. I’ve got the sourcecode on my local machine and have copied the executable to the local drive of a server.
If I double click on a rowheader in the grid I call this event below.
Then I double click on one of the cells in the grid.
Then I exit the SuppliedFileChange_Load form and return to the SuppliedFile form.
If I then double click on another rowheader in the grid I get the error message which is the title of the question.
This only happens when I run the executable. It does not happen when I run the source code.
Any ideas?
Private Sub Grid2_RowHeaderMouseDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellMouseEventArgs) Handles Grid2.RowHeaderMouseDoubleClick
SuppliedFileChange.ShowDialog()
End Sub
Private Sub SuppliedFileChange_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Grid3.Height = Me.Height – (Grid3.Top * 1.5)
Grid3.Width = Me.Width * 15 / 16
lblUpdate.Top = Grid3.Bottom
Me.Top = rect.Height / 2
Me.Height = rect.Height / 2
Me.Left = rect.Left
i = SuppliedFile.Grid2.CurrentRow.Index
cmd1.Connection = con1
cmd1.CommandText = “xxx”
cmd1.CommandType = CommandType.StoredProcedure
cmd1.Parameters.Clear()
cmd1.Parameters.AddWithValue(“@SuppliedfileID”, SuppliedFile.Grid2(17, i).Value())
cmd1.ExecuteNonQuery()
adapter.SelectCommand = cmd1
dt.Clear()
adapter.Fill(dt)
For Each dr In dt.Rows
StatusCodeFlag = dr(“StatusCode”).ToString.Trim
Next
If StatusCodeFlag = “CONF” Or StatusCodeFlag = “PRIF” Then
cmdResetToRecv.Enabled = True
Else
cmdResetToRecv.Enabled = False
End If
‘End Using
Grid3.DataSource = dt
Grid3.Columns(15).Visible = False
Grid3.Columns(16).Visible = False
Grid3.Columns(17).Visible = False
ColorMyGrid()
lblserver.Text = “You are connected to ” & connectionString
cCmd.Dispose()
End Sub
Solution : Operation is not valid because it results in a reentrant call to the setcurrentcellAddressCore Function
The user clicks on the rowheader or column header. Can I make, so the user can’t click on the individual cells?