Multiple Click Error in datagridview

Khushi07

New member
Joined
Jan 7, 2011
Messages
2
Programming Experience
Beginner
When I click multiple times in Datagridview of VB.net WinForms, it gives following error: columncount property cannot be set on a data-bound DataGridView control
 

jmcilhinney

VB.NET Forum Moderator
Staff member
Joined
Aug 17, 2004
Messages
14,454
Location
Sydney, Australia
Programming Experience
10+
I would guess that you are handling some event and, in the event handler, doing something that causes the ColumnCount to get set. Can you show us the stack trace for the exception? The Exception Assistant box that appears has various options on it, one of which is View Details.
 

Khushi07

New member
Joined
Jan 7, 2011
Messages
2
Programming Experience
Beginner
Multiple Click Error in datagridview in Vb.net WinForm

If single or double clicked, there is no error But if continuous multiple clicked then that error

However, No code on click event But the following code on the double click event:

Private Sub dgvDossierView_CellDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgvDossierView.CellDoubleClick
If e.ColumnIndex = -1 Or e.RowIndex = -1 Then Exit Sub
frmClientDossiersView.Close()
If dgvDossierView.CurrentCell.ColumnIndex = 0 Then
ClientDossier = dgvDossierView.Item(0, dgvDossierView.CurrentCell.RowIndex).Value.ToString
frmClientDossiersView.txtReln.ReadOnly = True
frmClientDossiersView.btnSearchRelation.Enabled = False
If frmClientDossiersView Is Nothing OrElse frmClientDossiersView.IsDisposed Then
frmClientDossiersView.Show()
Else
frmClientDossiersView.BringToFront()
frmClientDossiersView.Show()
End If
End If
End Sub
 
Top Bottom