Solved

VB6 - Highlight single MSHFlexgrid cell when selecting

Posted on 2013-01-27
3
1,122 Views
Last Modified: 2013-01-27
Hello all

I would like to know if it is possible to highlight single MSHFlexgrid1 cell when i select on and if a change cell, it will put back to regular color the previous one and highlight new cell selected?

How can i do that?

Thanks again for your help
0
Comment
Question by:Wilder1626
  • 2
3 Comments
 
LVL 47

Accepted Solution

by:
Martin Liss earned 500 total points
ID: 38825159
You can do it through code. This highlights in yellow. Choose any color you wish.


Private Sub MSHFlexGrid1_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)

Dim lngRow As Long
Dim lngCol As Long
Dim intSaveRow As Integer
Dim intSaveCol As Integer

With MSHFlexGrid1
    intSaveRow = .Row
    intSaveCol = .Col

    For lngRow = 1 To .Rows
        For lngCol = 1 To .Cols
            .FillStyle = flexFillSingle
            .Row = lngRow - 1
            .Col = lngCol - 1
            .CellBackColor = vbWhite
        Next
    Next
    
    .Row = intSaveRow
    .Col = intSaveCol
    .CellBackColor = vbYellow
End With
End Sub

Open in new window

0
 
LVL 11

Author Closing Comment

by:Wilder1626
ID: 38825258
Hi again

This is again perfect

Thanks
0
 
LVL 47

Expert Comment

by:Martin Liss
ID: 38825283
You're welcome again and I'm glad I was able to help.

Select the 'About Me' tab in my profile and you'll find links to some articles I've written that may interest you.
Marty - MVP 2009 to 2012
0

Featured Post

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VBA filters 2 71
message box in access 4 52
Getting warning: You are about to delete 1 row(s) 9 54
"Failed to convert parameter value from a String to a Decimal." 4 33
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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 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…

730 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