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 9243907
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T08:54:37+00:00 2026-06-18T08:54:37+00:00

I need to check a picturebox for a specific image. I know you can

  • 0

I need to check a picturebox for a specific image. I know you can check if the picturebox is populated with an image…

If Not pictureBox.Image is Nothing Then

Else

End If

But in my case, I need to check this picturebox for an image I loaded earlier on in the process.

Here is the current code I’m using to load the image…

PictureBox1.Image = My.Resources.TestImage1

I thought by using the following code I could check the image name, but this apparently does not work.

If PictureBox1.Image = My.Resources.TestImage1 Then
  'do something
Else
  'do something else
End if

Suggestions?

  • 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-18T08:54:38+00:00Added an answer on June 18, 2026 at 8:54 am

    Image does not have any knowledge of the file name or any other name that it has been loaded from. What you can do, however, is compare images pixel-by-pixel. Try this code:

    Public Function AreSameImage(ByVal I1 As Image, ByVal I2 As Image) As Boolean
      Dim BM1 As Bitmap = I1
      Dim BM2 As Bitmap = I2
      For X = 0 To BM1.Width - 1
        For y = 0 To BM2.Height - 1
          If BM1.GetPixel(X, y) <> BM2.GetPixel(X, y) Then
            Return False
          End If
        Next
      Next
      Return True
    End Function
    

    Credit goes here.

    A useful article I found when looking for this answer:

    • Compare two images to find differences greater than a threshold value in VB .NET

    This is how you can check if your images are less than 100% equal, i.e. similar.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to check if a link (a-tag) is the only content (not just
I need to check if some object has text property. For example it can
I'm trying to make a checkbox that has a custom check image. I need
I need some help with regular expression. I need check login, login can have
I need to check that a List contains or not values that are greater
I need to check if a certain application is installed (I know what it
I need to check a DateTime object is at specific date. Actually, date of
I'm using VB.NET forms app and I need to check if a PictureBox currently
I need check whether a given array will match another array. I can't figure
I need to check that some content exists on the page within a specific

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.