|
-
May 11th, 2006, 10:12 PM
#1
Thread Starter
Fanatic Member
-
May 11th, 2006, 10:33 PM
#2
Re: MSFLEXGRID - Selecting Row with Merge
VB Code:
MSFlexGrid1.RemoveItem MSFlexGrid1.Row
-
May 11th, 2006, 10:47 PM
#3
Thread Starter
Fanatic Member
Re: MSFLEXGRID - Selecting Row with Merge
Hi, tks
But It removed only 1 row , I want to remove 3 rows
-
May 11th, 2006, 11:14 PM
#4
Hyperactive Member
Re: MSFLEXGRID - Selecting Row with Merge
r the three rows selected...if yes then u need to loop thru grid and check for selected rows and delete them
-
May 12th, 2006, 04:57 AM
#5
Thread Starter
Fanatic Member
Re: MSFLEXGRID - Selecting Row with Merge
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
-
May 12th, 2006, 10:34 AM
#6
Re: MSFLEXGRID - Selecting Row with Merge
How can I do to all columns show with background other collor when the row is selected ?
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=404776
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
Last edited by brucevde; May 12th, 2006 at 10:43 AM.
Reason: Added link to another thread
-
May 13th, 2006, 05:03 AM
#7
Thread Starter
Fanatic Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|