I had prepared 2 pictures, where you could see it, but I am not allowed to add them (Options=>File attachment=>Add=> You do not have permission to upload or link to files. Please contact your system administrator.) I can send them to you somehow.
Bugs:
Private Sub DataGrid_CellFormatting(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellFormattingEventArgs) Handles DataGrid.CellFormatting
If Equals(Me.DataGrid.Columns(e.ColumnIndex), Me.PERSKDataGridViewTextBoxColumn) Then
AB3Controls.CellFormat.PersonCode(e)
ElseIf Equals(Me.DataGrid.Columns(e.ColumnIndex), Me.SEXDataGridViewTextBoxColumn) Then
AB3Controls.CellFormat.Sex(e)
End If
End Sub
1) usnig this code on textboxcolumn:
Shared Sub PersonCode(ByRef e As System.Windows.Forms.DataGridViewCellFormattingEventArgs)
If e.Value IsNot Nothing AndAlso CStr(e.Value).Length > 6 Then
e.Value = CStr(e.Value).Insert(6, "-")
End If
End Sub
Results:
a) In DataGrdiView (Expected): There is "-" symbol inserted in cells, There is no "-" symbol inserted in column Header
b) In Print, PrintPreview, exports too: There is "-" symbol inserted in cells, There is "-" symbol inserted in column Header (CellFormatting event is used on colum header - DataGridView do not do this)
2) usnig this code on textbox column:
Shared Sub Sex(ByRef e As System.Windows.Forms.DataGridViewCellFormattingEventArgs)
If Equals(e.Value, Nothing) Then
e.Value = "Nezināms"
ElseIf Equals(e.Value, True) Then
e.Value = "Vīrietis"
Else
e.Value = "Sieviete"
End If
End Sub
results:
a) In DataGrdiView (Expected): There is correct Column Header text, there is values "Vīrietis" or "Sieviete" or "Nezināms" only in this column
b) In Print, PrintPreview, exports too (Actual): Header text is formatted by CellFormatting event. there is checkboxes checked and unchecked only in this column