Solved

VB6 - Highlight single MSHFlexgrid cell when selecting

Posted on 2013-01-27
3
1,004 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 45

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 45

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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

706 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

15 Experts available now in Live!

Get 1:1 Help Now