Results 1 to 3 of 3

Thread: Why do I get this error when I put an image in a button or picturebox?

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Apr 2023
    Posts
    31

    Why do I get this error when I put an image in a button or picturebox?

    Hi, there,

    Do you know why when I put an image in a button or in a picturebox I get this error (the 1st picture) and when I click ok I get this error (the second picture)?

    Thanks

    Name:  erreur.PNG
Views: 110
Size:  5.2 KB

    Name:  erreur2.PNG
Views: 109
Size:  5.7 KB

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,299

    Re: Why do I get this error when I put an image in a button or picturebox?

    Please provide a more detailed explanation of the problem. Provide us with the steps that we can follow to either reproduce the issue or confirm that it is specific to your project. You should also have tried the same thing in a new project, to see whether it's project-specific or affects all projects on your system.

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Apr 2023
    Posts
    31

    Re: Why do I get this error when I put an image in a button or picturebox?

    Thanks for your help,

    So I add a standard button, click on "image" in the property, a dialog box opens asking me if I want to save the changes to FMain.res. I click on save, another dialog box opens and I choose "Project resource file" and import my PNG image then I click on Ok and my image is displayed on the button.

    I test by running the debugger and get the famous error message above.

    I tried the same steps in a new project but it works fine, I don't get any error message for displaying an image in a button or a pictureBox.

    The problem comes from my project

    I have a simple button

    Code:
          private void button1_Click(object sender, EventArgs e)
              {
                ......
              }
    I also noticed that some .resx files have been added to the project (circled in red).

    Name:  1.png
Views: 50
Size:  22.4 KB


    I tried that but no change
    https://stackoverflow.com/questions/...ror-after-impo
    Last edited by Sun2k; Jun 1st, 2023 at 02:36 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width