MSFLEXGRID - Delete Rows with Mescled columns
I want to delete some rows from FLEXGRID , with MERGE some rows , (see figure )
I tried with routine below, but do not work
What is wrong ?
Code:
Private Sub Deleta_Servicos()
Dim LngStartRow As Long
Dim lngEndRow As Long
Dim icont As Long
With Me.MSFlexGrid1
.ReDraw = False
lngEndRow = Me.MSFlexGrid1.Row
Do
If lngEndRow = .Rows - 1 Then Exit Do
If .TextMatrix(lngEndRow + 1, 0) = "" Then Exit Do
lngEndRow = lngEndRow + 1
Loop
LngStartRow = .Row
Do
If LngStartRow = .FixedRows Then Exit Do
If .TextMatrix(LngStartRow - 1, 0) = "" Then Exit Do
LngStartRow = LngStartRow - 1
Loop
For icont = LngStartRow To lngEndRow + 1
MSFlexGrid1.RemoveItem icont
Next
.ReDraw = True
End With
End Sub
http://www.vbforums.com/attachment.p...id=47651&stc=1
Thanks
Re: MSFLEXGRID - Delete Rows with Mescled columns
When using RemoveItem either loop in reverse order or always delete the same row
VB Code:
For icont = lngEndRow to LngStartRow Step -1
MSFlexGrid1.RemoveItem icont
Next
Or
For icont = LngStartRow to lngEndRow
MSFlexGrid1.RemoveItem LngStartRow
Next