|
-
Sep 7th, 2012, 10:50 AM
#8
Re: How to highlight a record in a MSHFlexGrid?
Create a private subroutine (I called my HIGHLIGHTING). Call that function after this line: fgdCompany.TopRow = myRow.
To find the original backcolor.....look at the properties of your MSFlexgrid, and find the one called 'backcolor'. You can use the hexidecimal to reset, or RGB equivalent, or VBs Constants.
I use a free application (colorpicker) to find ANY RGB color.....to make it easy, set your grid's backcolor at initialization to someting like vbWhite, then you can use another VB Constant (liek vbGreen) to highlight
xString = txtSearch.Text
For xNext = 0 To fgdCompany.Rows
fgdCompany.Row = xNext
xRow = fgdCompany.Row
If xString = fgdCompany.TextMatrix(xRow, 1) Then
myRow = fgdCompany.Row
fgdCompany.TopRow = myRow
CALL HIGHLIGHTING
Exit For
End If
Next xNext
Private Sub highlighting()
For X = 0 To MSFlexGrid1.Cols - 1
MSFlexGrid1.Col = X
For Y = 1 To MSFlexGrid1.Rows - 1
MSFlexGrid1.Row = Y
MSFlexGrid1.CellBackColor = vbYellow 'assuming vbYellow is original BG color
Next Y
Next X
For Z = 0 To MSFlexGrid1.Cols - 1
MSFlexGrid1.Col = Z
MSFlexGrid1.Row = rownumber1
MSFlexGrid1.CellBackColor = vbGreen
Next Z
END SUB
Tags for this Thread
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
|