I created a DataGridNoActiveCellColumnMultiple by inheriting from DataGridTextBoxColumn. I overloaded the paint procedure:
Now, sometimes (not reproduceable) I get following error:
The object is currently in use elsewhere
Unfortunately I have no idea what to do?!
Visual Basic:
Protected Overloads Overrides Sub Paint(ByVal g As Graphics, ByVal bounds As Rectangle, ByVal source As CurrencyManager, ByVal rowNum As Integer, ByVal backBrush As Brush, ByVal foreBrush As Brush, ByVal alignToRight As Boolean)
Try
If Not mblnMitKonvertierung Then
MyBase.Paint(g, bounds, source, rowNum, backBrush, foreBrush, alignToRight)
Else
Select Case mintKonvertierung
Case enmKonvertierungsArt.kaZugriffsart
Dim intZugriff As Integer
intZugriff = CInt(CType(source.Current, DataRowView).DataView.Table.Rows(rowNum).Item("Zugriffsart"))
MyBase.PaintText(g, bounds, mstrZugriff(intZugriff), backBrush, foreBrush, alignToRight)
Case enmKonvertierungsArt.kaBenutzer
Dim strKuerzel As Char
Dim strGruppe As String
strKuerzel = CChar(CType(source.Current, DataRowView).DataView.Table.Rows(rowNum).Item("Icon"))
strGruppe = CStr(CType(source.Current, DataRowView).DataView.Table.Rows(rowNum).Item("Benutzer"))
MyBase.PaintText(g, bounds, mstrName(strKuerzel, strGruppe), backBrush, foreBrush, alignToRight)
End Select
End If
Catch ex As System.Exception
'do something
End Try
End Sub
Now, sometimes (not reproduceable) I get following error:
The object is currently in use elsewhere
Unfortunately I have no idea what to do?!