Solved

VB6 - Highlight single MSHFlexgrid cell when selecting

Posted on 2013-01-27
3
1,167 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
[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
3 Comments
 
LVL 48

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 48

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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

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…
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 process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

696 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