Solved

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

Posted on 2006-11-25
4
458 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…
Suggested Courses
Course of the Month4 days, 3 hours left to enroll

630 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