|
-
Mar 22nd, 2008, 11:54 AM
#1
Thread Starter
New Member
help: Pict viewer with like clause code
here is the problem, i got a simple picture viewer prog. which can view pics from folders but this program'll got an error if i choose any file than jpg or jpeg file, i just thought that vb 6 couldnt read other pict file like *.png
*.png is quite used for manga scan (i mean scanned comics), so i just use this code to cover prog error :
Private Sub filImage_Click()
gmbr = filImage.Path & "\" & filImage.FileName
If gmbr Like "%.jpg" Then
imgImage.Picture = LoadPicture(gmbr)
txtNama.Text = gmbr
lblErr.Visible = False
Else: lblErr.Visible = True
End If
End Sub
As expected, this code will make the lblErr contain notes i made always appear wherever i select the file, since theres no file named "%.jpg", how to make it understand what i want it to be?
gmbr in here is variable contain the file we choose in filelistbox
IF the file has *.jpg or *.jpeg extention or any pict file readable by vb THEN
the selected pict file'll be loaded into Image tool
ELSE the lblErr contain notes'll appear.
-
Mar 22nd, 2008, 12:03 PM
#2
Re: help: Pict viewer with like clause code
Try using: If InStr(gmbr, ".jpg") Or InStr(gmbr, ".jpeg") Then...
VB's image control can load the following image types: bmp, jpg, gif, ico, cur, wmf, emf. It cannot load the following: not all XP & Vista icons, PNGs, TIFFs, TGAs, and most custom application image formats like Photoshop.
If you wish to experiment with a custom control, you are welcome to try one I created & posted on this form: Alpha Image Control. It can display PNGs, all XP & Vista icons and if GDI+ is installed on the system (it is on XP & Vista and free for other systems), TIFFs too. That custom control takes a little getting used to and has a help documentation included in the form of a rich text file.
-
Mar 22nd, 2008, 12:27 PM
#3
Thread Starter
New Member
Re: help: Pict viewer with like clause code
thx man, i'll try it then...
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
|