hello, i am using picture box, and coding on form load
P1.Picture = "D:\My Document\My Pictures\Display Picture\ICE.BMP"
why it gives "TYPE MISSMACH" Error.
plz reply soon.
Yasir
hello, i am using picture box, and coding on form load
P1.Picture = "D:\My Document\My Pictures\Display Picture\ICE.BMP"
why it gives "TYPE MISSMACH" Error.
plz reply soon.
Yasir
Quick diagnosis: the Picture property of a VB6 picture/image control expects an object (a StdPicture/IPictureDisp), not a plain string path. That is why assigning a literal filename like you did causes a "Type mismatch". pointed toward LoadPicture — that’s the right idea, but remember in VB6 you should assign an object reference (use Set) and verify the file actually exists.
If the image is local, the usual workflow is: confirm the file path, then load the picture object and assign it. For images on the web, download the image to a temporary file first and then load it into the control. Example using URLDownloadToFile:
Private Declare Function URLDownloadToFile Lib "urlmon" Alias "URLDownloadToFileA" _
(ByVal pCaller As Long, ByVal szURL As String, ByVal szFileName As String, _
ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long
Dim tmp As String
tmp = App.Path & "\tmpimg.jpg"
If URLDownloadToFile(0, sURL, tmp, 0, 0) = 0 Then
Set Picture1.Picture = LoadPicture(tmp)
Else
MsgBox "Download failed"
End If An alternate, more robust approach (works when the server returns image bytes without a straightforward filename, e.g. a .php URL) uses MSXML2.XMLHTTP + ADODB.Stream to write the response to disk, then load it. This avoids relying on external browser controls; ’s WebBrowser trick is handy for quick display but isn’t ideal when you need the image data inside a PictureBox.
Quick troubleshooting checklist:
Set when assigning objects.This covers the typical causes and two practical ways to load local and remote images into a VB6 picture control.
Jump to Post— AV Manoharan 0hello, i am using picture box, and coding on form load
P1.Picture = "D:\My Document\My Pictures\Display Picture\ICE.BMP"
why it gives "TYPE MISSMACH" Error.
plz reply soon.
Yasir
The correct syntax is
P1.Picture = LoadPicture("C:\MyPict.bmp")
thanks to veena
Jump to Post— QVeen72 104Hi Manoharan..
Why Thank Me....???
-Vee
Jump to Post— AV Manoharan 0Hi Manoharan..
Why Thank Me....???
-Vee
Don't you remember your own answers in this forum?
But I do.regards
AV Manoharan
hello, i am using picture box, and coding on form load
P1.Picture = "D:\My Document\My Pictures\Display Picture\ICE.BMP"
why it gives "TYPE MISSMACH" Error.
plz reply soon.
Yasir
The correct syntax is
P1.Picture = LoadPicture("C:\MyPict.bmp")
thanks to veena
Hi Manoharan..
Why Thank Me....???
-Vee
Hi Manoharan..
Why Thank Me....???
-Vee
Don't you remember your own answers in this forum?
But I do.
regards
AV Manoharan
The correct syntax is
P1.Picture = LoadPicture("C:\MyPict.bmp")
thanks to veena
yeah but what about if i want to load an impage from the internet? and if the image isn't bmp? It says file/path access error... could someone help me?
yeah but what about if i want to load an impage from the internet?
Sorry I don't know what is an impage...
and if the image isn't bmp? It says file/path access error... could someone help me?
Use a Common Dialog Box
CommonDialog1.Filter = "Picture Files (*.bmp;*.jpg;*.gif)|*.bmp;*.jpg;*.gif;|"
CommonDialog1.ShowOpen
Image1.Picture = LoadPicture(CommonDialog1.FileName)
i meant image... not impage... sorry for that typo :D
well if the image isn't stored in the local PC, but is in a web site... for example if i want this displayed in a picturebox, how do i do it...?
Hi edu,
use a "WebBrowser" Control and Navigate it to the url. check this
WebBrowser1.Navigate2 "http://www.whateverwebsite.com/imagesfolder/myimage.jpg"
Regards
Veena
Thanks, it worked ;)
me.picture(app.path&"name with extention of the pictur")
use a "WebBrowser" Control and Navigate it to the url. check this
WebBrowser1.Navigate2 "http://www.whateverwebsite.com/imagesfolder/myimage.jpg"
from: QVeen72
---------------------------------------------------
hi there.
i have the same problem regarding with image.
what if the image in the web has extension name of .php?
how will i get it?
by the way, i am using vb6.0, a web browser and an imagebox where i will put the web image(.php) later on.
thank you in advance :)
mizkhyz,
This thread is nearly two years old! In the future please start your own thread and if need be reference previous thread by copying and pasting the link in your thread. Also, it would help if you pasted the link to the php page you need help with as there could be a couple of different ways to solve your problem.
mizkhyz,
This thread is nearly two years old! In the future please start your own thread and if need be reference previous thread by copying and pasting the link in your thread. Also, it would help if you pasted the link to the php page you need help with as there could be a couple of different ways to solve your problem.
hi sir, sorry for what i did. I am new here and i don't know how to delete what id post to correct my mistake. I am starting to learn.
I just copied the paragraph and put the name from whom it came and write my question below it.
I don't have any bad intension on it.
By the way. thanks for the advice.:) :)
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.