Results 1 to 3 of 3

Thread: help: Pict viewer with like clause code

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2008
    Posts
    4

    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.

  2. #2
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    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.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  3. #3

    Thread Starter
    New Member
    Join Date
    Mar 2008
    Posts
    4

    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
  •  



Click Here to Expand Forum to Full Width