-
Oct 3rd, 2019, 02:56 PM
#1
Thread Starter
Hyperactive Member
[RESOLVED] LoadPicture issue
How do I load a bitmap file into a picturebox?
I thought I could do it using VB's LoadPicture like this
Picture1.Picture = LoadPicture(App.Path & "\MyPicture.bmp") but I get a Type Mismatch error and the & is highlighted.
and if I use the CommonDialogue to open the file and I use
Picture1.Picture = LoadPicture(.FileName) I also get a Type Mismatch error
If I put the entire path in a variable....
Dim PictureFilePath As String
Picture1.Picture = LoadPicture(PictureFilePath) I get a ByRef argument type mismatch
-
Oct 3rd, 2019, 03:11 PM
#2
Fanatic Member
-
Oct 3rd, 2019, 03:43 PM
#3
Thread Starter
Hyperactive Member
Re: LoadPicture issue
Set Picture1.Picture = LoadPicture(...)
doesn't change any of the errors
-
Oct 3rd, 2019, 04:26 PM
#4
Thread Starter
Hyperactive Member
Re: LoadPicture issue
OK, never mind, I found the reason
I had a copy of the code from the user control placed in a .bas module. I was just saving it there for some reason that I have now forgot about. When I removed the module the LoadPicture worked
-
Oct 3rd, 2019, 04:32 PM
#5
Fanatic Member
Re: [RESOLVED] LoadPicture issue
Search your code for "LoadPicture". If you defined a Sub/function with that name, then VB would use it instead.
-
Oct 3rd, 2019, 08:01 PM
#6
Re: [RESOLVED] LoadPicture issue
You can also use VB.LoadPicture() instead of defaulting to the global namespace.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|