Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8633283
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T09:28:08+00:00 2026-06-12T09:28:08+00:00

I have created a DataGridViewImageColumn and want to perform operation if the value of

  • 0

I have created a DataGridViewImageColumn and want to perform operation if the value of the image cell is green check box image.
The code is given below. But its not going inside the condition

if (dgvException.Rows[e.RowIndex].Cells["colStock"].Value 
                                              == Properties.Resources.msQuestion)
{
    //Some code
}

Please help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T09:28:09+00:00Added an answer on June 12, 2026 at 9:28 am

    Checking equality for images using the equality operator (==) doesn’t work the way you need it to work. That’s why with your equality check always returns false.

    You need to find out if the content of two images are the same — to do this you’ll need to do a pixel by pixel check of the image in the DGV cell and the reference image. I found a few links to this article that demonstrates comparing two images. I’ve taken the image comparison algorithm from the article and condensed it into a method that takes two Bitmaps to compare as parameters and returns true if the images are identical:

    private static bool CompareImages(Bitmap image1, Bitmap image2) {
        if (image1.Width == image2.Width && image1.Height == image2.Height) {
            for (int i = 0; i < image1.Width; i++) {
                for (int j = 0; j < image1.Height; j++) {
                    if (image1.GetPixel(i, j) != image2.GetPixel(i, j)) {
                        return false;
                    }
                }
            }
            return true;
        } else {
            return false;
        }
    }
    

    (warning: code not tested)

    Using this method your code becomes:

    if (CompareImages((Bitmap)dgvException.Rows[e.RowIndex].Cells["colStock"].Value, Properties.Resources.msQuestion)) {
        //Some code 
    } 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a tab-pane using HAML as shown in my code snippet below
I have created an Enum and want to read the text value from it.
I have created an inherited document class, see the code below. The documents persists
I have created two imageViews promatically as shown below: public void createImageViews(Integer count){ ImageView[]
i have created and want to now import a dummy collection. one of the
Have created an attribute property in TableView1.h and pushing that attributes value to another
I have created a new Bitmap object and now want do draw some text
I have created stylish asp.net controls and have placed the source code and dll
I have created a stack panel and added that in a list box .
I have created an ajax driven website which can load any page when given

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.