|
-
Feb 11th, 2008, 07:19 AM
#1
Thread Starter
Frenzied Member
Not image found
I have problem here, When the image not found, then I want to show Image is not Available. But When the image not available is shown, I unable to clear that image before another image is shown. How to clear this?
Code:
Private Sub ListView3_ItemClick(ByVal item As MSComctlLib.ListItem)
Pesttable.MoveFirst
Pesttable.Move CLng(item.Index - 1)
sTarikh = item.Text
Command21.Enabled = True
Command22.Enabled = True
Form18.getID = Pesttable.Fields("id").Value
Text21.Text = Pesttable.Fields("Nama Perosak").Value & ""
Text23.Text = Pesttable.Fields("Nama Sintifik").Value & ""
Text24.Text = Pesttable.Fields("Tanda serangan").Value & ""
Picture2.Cls
Picture2.AutoRedraw = True
Picture2.ScaleMode = vbPixels
On Error GoTo error3:
Picture2.PaintPicture LoadPicture(Pesttable.Fields("Gambar")), 0, 0, 200, 200
Exit Sub
error3:
If Err.Number = 481 Then
Dim strImagePath As String
strImagePath = App.Path & "\ancaman padi\NoImage.gif"
Picture2.Picture = LoadPicture(strImagePath)
Picture2.AutoRedraw = False
Picture2.Cls
Exit Sub
End If
End Sub
-
Feb 11th, 2008, 08:43 AM
#2
Addicted Member
Re: Not image found
 Originally Posted by matrik02
vb Code:
error3:
If Err.Number = 481 Then
Dim strImagePath As String
strImagePath = App.Path & "\ancaman padi\NoImage.gif"
Picture2.Picture = LoadPicture(strImagePath)
Picture2.AutoRedraw = False
Picture2.Cls
Exit Sub
End If
End Sub
This images will never show because you clear the picturebox (line 7) right after you've loaded the image.
Jottum™
XpVistaControls , (transparent) usercontrols for XP, Vista and 7 with W2K legacy support.
-
Feb 11th, 2008, 03:28 PM
#3
Re: Not image found
vb Code:
picture2.picture = loadpicture()
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Feb 11th, 2008, 04:14 PM
#4
Addicted Member
Re: Not image found
 Originally Posted by westconn1
vb Code:
picture2.picture = loadpicture()
You are right of course, my bad.
Jottum™
XpVistaControls , (transparent) usercontrols for XP, Vista and 7 with W2K legacy support.
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
|