Hi
How can I to do it :
When the user to Click a row, to select the Row , Where there are rows that were merged
How can I to Delete the row selectioned ?
Thank you in advance
Printable View
Hi
How can I to do it :
When the user to Click a row, to select the Row , Where there are rows that were merged
How can I to Delete the row selectioned ?
Thank you in advance
VB Code:
MSFlexGrid1.RemoveItem MSFlexGrid1.Row
Hi, tks
But It removed only 1 row , I want to remove 3 rows
r the three rows selected...if yes then u need to loop thru grid and check for selected rows and delete them
tKS
btw - Do you Have a example ?
How can I know if row is selected ?
How can I do to all columns show with background other collor when the row is selected ?
TIA
In another thread that you started there was a suggestion to insert a Hidden blank row between each group (so columns in different groups are not merged). http://www.vbforums.com/showthread.php?t=404776Quote:
How can I do to all columns show with background other collor when the row is selected ?
If you are using this suggestion then use the following code to highlight the selected group of merged rows.
Basically, you find the the first hidden blank row before and after the current row. These become your Row and RowSel values. Then just colour all cells in the range.
VB Code:
Private Sub MSFlexGrid1_SelChange() Dim lngStartRow As Long Dim lngEndRow 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 'remove the highlighting of the previously selected group .FillStyle = flexFillRepeat .Row = .FixedRows .Col = 0 .RowSel = .Rows - 1 .ColSel = .Cols - 1 .CellBackColor = .BackColor 'highlight the newly selected group .Row = lngStartRow .Col = .FixedCols .ColSel = .Cols - 1 .RowSel = lngEndRow .CellBackColor = .BackColorSel .FillStyle = flexFillSingle .Redraw = True End With End Sub
Code to initialize the grid for testing...
VB Code:
Private Sub Form_Load() With Me.MSFlexGrid1 .Cols = 4 .Rows = 10 .FixedCols = 0 .TextMatrix(1, 0) = "A" .TextMatrix(1, 1) = "XXX" .TextMatrix(1, 2) = "1" .TextMatrix(1, 3) = "12.00" .TextMatrix(2, 0) = "A" .TextMatrix(2, 1) = "YYY" .TextMatrix(2, 2) = "1" .TextMatrix(2, 3) = "12.00" .TextMatrix(3, 0) = "A" .TextMatrix(3, 1) = "ZZZ" .TextMatrix(3, 2) = "1" .TextMatrix(3, 3) = "12.00" .RowHeight(4) = 0 .TextMatrix(5, 0) = "B" .TextMatrix(5, 1) = "ZZZ" .TextMatrix(5, 2) = "2" .TextMatrix(5, 3) = "12.00" .TextMatrix(6, 0) = "B" .TextMatrix(6, 1) = "ZZZ" .TextMatrix(6, 2) = "1" .TextMatrix(6, 3) = "12.00" .RowHeight(7) = 0 .TextMatrix(8, 0) = "C" .TextMatrix(8, 1) = "XXX" .TextMatrix(8, 2) = "2" .TextMatrix(8, 3) = "12.00" .TextMatrix(9, 0) = "C" .TextMatrix(9, 1) = "YYY" .TextMatrix(9, 2) = "2" .TextMatrix(9, 3) = "13.00" .MergeCells = flexMergeRestrictColumns .MergeCol(0) = True .MergeCol(2) = True .MergeCol(3) = True Call MSFlexGrid1_SelChange End With End Sub
Thanks
I build other project with your solution, WORK FINE , but when I put inside my Original project not work :( :(