LoadBitmaps error

afries1980

New member
Joined
Feb 18, 2023
Messages
1
Programming Experience
1-3
System.ArgumentException
HResult=0x80070057
Message=Parameter is not valid.
Source=System.Drawing

Plz help. Code is...

Private Sub loadBitmaps()
slotAnimation = New Bitmap() {New Bitmap("images/1.png"),
New Bitmap("images/4.png"),
New Bitmap("images/5.jpg"),
New Bitmap("images/wild.png"),
New Bitmap("images/3.png")}
End Sub
 
My first guess is that the slashes should be the other way. Forward slashes are used in URLs while backslashes are used in Windows file paths. I'm not sure whether you can use either in that specific scenario but that's the first thing I'd try. Also, are you absolutely sure that there is an images folder with those files in the current directory of the process? You really ought to use absolute paths, which you could do by using Application.StartupPath to get the path of the program folder.
 
Back
Top