Solved

VB6 - Highlight single MSHFlexgrid cell when selecting

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

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 46

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

914 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

19 Experts available now in Live!

Get 1:1 Help Now