[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

How to find which image is in a msflexgrid cell

Posted on 2014-08-06
5
Medium Priority
?
126 Views
Last Modified: 2014-08-06
I have a msflexgrid that loads an image of a  unchecked checkbox in a cell
If the image is clicked it replaces the the unchecked checkbox image with a checked checkbox
if it is clicked again i want to replace the checked checkbox with the unchecked checkbox
How can i determine which image is in the cell ?
0
Comment
Question by:isnoend2001
  • 3
  • 2
5 Comments
 
LVL 50

Expert Comment

by:Martin Liss
ID: 40245349
Create an array with True:False values that indicate which image is in which cell. If you'll attach a zip of your project I'll help further.
0
 

Author Comment

by:isnoend2001
ID: 40245363
Thanks Martin Liss the project is way too big. I was hoping there would be a easier way to determine the image
something like this:
With GridMain
    .Row = .Rows - 1
    .Col = 4
  If .CellPicture = "unchecked" Then
    MsgBox "Unchecked"
   Else
    MsgBox "checked"
   End If
 End With

Open in new window

this does not work
I could also create a hidden column to hold booleans
the image is loaded from a resource file like this:
 With GridMain
        .Row = .Rows - 1
        .Col = 4
        .CellPictureAlignment = flexAlignCenterCenter
        Set .CellPicture = LoadResPicture("unchecked", vbResBitmap) 'unchecked mark
    End With

Open in new window

0
 
LVL 50

Accepted Solution

by:
Martin Liss earned 2000 total points
ID: 40245366
OK at the top of your form add this:
Option Explicit
Private mbCheckBoxStatus() As Boolean

Open in new window


In Form_Load add this:
ReDim mbCheckBoxStatus(flexStatus.Rows - 1, flexStatus.Cols - 1)

Open in new window


And in the Click event of your flexgrid add this and of course in this and Form_Load change flexStaus to the name of your grid.

mbCheckBoxStatus(flexStatus.Row, flexStatus.Col) = Not mbCheckBoxStatus(flexStatus.Row, flexStatus.Col)
MsgBox mbCheckBoxStatus(flexStatus.Row, flexStatus.Col)

Open in new window

0
 

Author Closing Comment

by:isnoend2001
ID: 40245389
Thanks
0
 
LVL 50

Expert Comment

by:Martin Liss
ID: 40245391
Glad I could help.
0

Featured Post

Industry Leaders: 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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
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…
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

834 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