Hi! I've found this code in the net that merges rows successfully. However, the data is being written in the last row of the merge rows. What I want is that it should be written on the first instead. This is the code:
Using gridBrush As Brush = New SolidBrush(Me.dgSM.GridColor), backColorBrush As Brush = New SolidBrush(e.CellStyle.BackColor)
Using gridLinePen As Pen = New Pen(gridBrush)
e.Graphics.FillRectangle(backColorBrush, e.CellBounds)
If intRow < dgSM.Rows.Count - 1 AndAlso dgSM.Rows(intRow + 1).Cells(7).Value.ToString() = e.Value.ToString() Then
e.Graphics.DrawLine(gridLinePen, e.CellBounds.Left, e.CellBounds.Bottom - 1, e.CellBounds.Right - 1, e.CellBounds.Bottom - 1)
e.Graphics.FillRectangle(backColorBrush, e.CellBounds)
End If
e.Graphics.DrawLine(gridLinePen, e.CellBounds.Right - 1, e.CellBounds.Top, e.CellBounds.Right - 1, e.CellBounds.Bottom)
e.Handled = True
End Using
End Using
This is the output: