Solved

.HighLight = flexHighlightAlways Can this be changed to a specific color

Posted on 2006-11-25
4
432 Views
Last Modified: 2013-12-26
I am using the mshflexgrid and have the control highlight set to  flexHighlightAlways in properties.
It always highlights in grey however. Is there a way to get it to highlight in another color or to get the cell to highlight, or to even get the text color in the cell to change color while it has the focus?
This is an appointment book and it would make it much easier if the users were sure of which client they were on.
0
Comment
Question by:mindserve
  • 2
4 Comments
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 18011844
You could set the cell's BackColor property instead.
0
 
LVL 1

Author Comment

by:mindserve
ID: 18012286
What about flex focus heavy,, light, can these colors be changed?
0
 
LVL 3

Expert Comment

by:AbhishekSharma
ID: 18056838
Following code will highlight the selected row

'-----------------------------------------------------------------------
'Add MSHFlexGrid grid to a form and copy - paste following code and try clicking on rows
Dim LastSelectedRow As Integer
Private Sub Command1_Click()
MSHFlexGrid1.FixedCols = 0
MSHFlexGrid1.FixedRows = 1
MSHFlexGrid1.Cols = 3
MSHFlexGrid1.Rows = 0
MSHFlexGrid1.SelectionMode = flexSelectionFree
MSHFlexGrid1.AllowUserResizing = flexResizeColumns

'Add Header Row in Grid
MSHFlexGrid1.AddItem "S.No" & vbTab & "Candidate Name" & vbTab & "Mobile No"

'Add rows in Grid
MSHFlexGrid1.AddItem "1" & vbTab & "Candidate 1" & vbTab & "1111111111"
MSHFlexGrid1.AddItem "2" & vbTab & "Candidate 2" & vbTab & "2222222222"
MSHFlexGrid1.AddItem "3" & vbTab & "Candidate 3" & vbTab & "3333333333"


End Sub

Private Sub MSHFlexGrid1_Click()
    'Save current selected row number
    CurrentSelectedRow = MSHFlexGrid1.Row
   
    'Loop through all columns
    For i = 0 To MSHFlexGrid1.Cols - 1
        'Set column
        MSHFlexGrid1.Col = i
        'Make font bold of cell set in above statement
        MSHFlexGrid1.CellFontBold = True
    Next
   
    'Following code is for clearing the last selected row
    MSHFlexGrid1.Row = LastSelectedRow
    For i = 0 To MSHFlexGrid1.Cols - 1
        MSHFlexGrid1.Col = i
        MSHFlexGrid1.CellFontBold = False
    Next
   
    'update variable which will hold the current selected row no.
    LastSelectedRow = CurrentSelectedRow
End Sub
'-------------------------------------------------------------------------------------------------------
0
 
LVL 3

Accepted Solution

by:
AbhishekSharma earned 125 total points
ID: 18056872
Following code will change the font color and also make the fond bold

'-----------------------------------------------------------------------
'Add MSHFlexGrid grid to a form and copy - paste following code and try clicking on rows

Dim LastSelectedRow As Integer
Private Sub Command1_Click()
MSHFlexGrid1.FixedCols = 0
MSHFlexGrid1.FixedRows = 1
MSHFlexGrid1.Cols = 3
MSHFlexGrid1.Rows = 0
MSHFlexGrid1.SelectionMode = flexSelectionFree
MSHFlexGrid1.AllowUserResizing = flexResizeColumns

'Add Header Row in Grid
MSHFlexGrid1.AddItem "S.No" & vbTab & "Candidate Name" & vbTab & "Mobile No"

'Add rows in Grid
MSHFlexGrid1.AddItem "1" & vbTab & "Candidate 1" & vbTab & "1111111111"
MSHFlexGrid1.AddItem "2" & vbTab & "Candidate 2" & vbTab & "2222222222"
MSHFlexGrid1.AddItem "3" & vbTab & "Candidate 3" & vbTab & "3333333333"


End Sub

Private Sub MSHFlexGrid1_Click()
    'Save current selected row number
    CurrentSelectedRow = MSHFlexGrid1.Row
   
    'Loop through all columns
    For i = 0 To MSHFlexGrid1.Cols - 1
        'Set column
        MSHFlexGrid1.Col = i
        'Make font bold of cell set in above statement
        MSHFlexGrid1.CellFontBold = True
        MSHFlexGrid1.CellForeColor = &H8000000D
    Next
   
    'Following code is for clearing the last selected row
    MSHFlexGrid1.Row = LastSelectedRow
    For i = 0 To MSHFlexGrid1.Cols - 1
        MSHFlexGrid1.Col = i
        MSHFlexGrid1.CellFontBold = False
        MSHFlexGrid1.CellForeColor = &H0&
    Next
   
    'update variable which will hold the current selected row no.
    LastSelectedRow = CurrentSelectedRow
End Sub
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now