Click here to Skip to main content
15,065,044 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi Everyone,

I'm doing a school project and I don't seem to be able to link my 16 checkboxes to all display a different picture in a picture box.

Currently I have this code in all checkboxes (with few details different)

---------------------------------------------------------------------------------------
Private Sub chkGarden_CheckedChanged(sender As Object, e As EventArgs) Handles chkGarden.CheckedChanged

picDisplay.Image = New Bitmap("I:\Resources\PicBox\Garden Cleaning- PicBox.png")

shrink(sender) ' Calls the function below shrink(sender), this single line of code is used instead of the whole 'if' loop

End Sub

------------------------------------------------------------------------------------

I however get this error when I try to check a checkbox when debugging it.
---------------------------------------------------------------------------------
A first chance exception of type 'System.ArgumentException' occurred in System.Drawing.dll

Additional information: Parameter is not valid.

If there is a handler for this exception, the program may be safely continued.
--------------------------------------------------------------------------------

Anyone help please?

What I have tried:

Private Sub chkGarden_CheckedChanged(sender As Object, e As EventArgs) Handles chkGarden.CheckedChanged

picDisplay.Image = New Bitmap("I:\Resources\PicBox\Garden Cleaning- PicBox.png")

shrink(sender) ' Calls the function below shrink(sender), this single line of code is used instead of the whole 'if' loop

End Sub
Posted
Updated 1-Nov-17 22:13pm

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900