Results 1 to 5 of 5

Thread: Picture box variable Uses?? *Answered*

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Oct 2001
    Location
    Florida
    Posts
    98

    Picture box variable Uses?? *Answered*

    Morning ladies, gentlemen, small children, pets and UDP packets.

    I have been looking around for a few days and still unable to find the meaning to life. Maybe i have been asking the wrong question but who knows. If someone could answer it for me, I would greatly appreciate it and be able to live in a state of ahh knowing such knowledge

    Mostly i am wondering about using a variable declared as a picturebox variable. I was wondering if its possible to declare said variable and not use an actual picture box item to work with the picture?

    For Example:

    VB Code:
    1. Dim Picture1Temp As PictureBox
    2.     Dim picture2Temp As PictureBox
    3.    
    4.     picture2Temp.Picture = LoadPicture(sDir & sFileName)

    the above code doesn't quite work when you go to load the picture you get the error . .

    Number: 91

    Object variable or with block variable not set.

    Now i know i am just overlooking something obvious, i don't normally work with graphics much and have been running a fever for 2 days, so needless to say, ye old brain is taking a vacation without me. Thanks much in advance for any assistance.
    Last edited by TheVoid; Sep 13th, 2002 at 07:56 AM.

  2. #2
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    The answer to the ultimate question is 42, in case you didn't know.

    Have you checked if the file you're referring to is existant? Mayne sPath doesn't end with a \, so you end up with something like:

    C:\path\to\my\filemyfile.bmp
    instead of
    C:\path\to\my\file\myfile.bmp
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Oct 2001
    Location
    Florida
    Posts
    98
    I would hope if that is the case microsoft would actually give the "File not found" error but then again this is microsoft stuff.

    You would pretty much get the same error even if you tried to change a property like.

    picture1temp.autoredraw = true

    Pretty much found the answer i was hoping not to hear in an alternate thread.

    http://www.vbforums.com/showthread.p...73#post1168173

    In case anyone else wants the answer.

    I ended up just putting two picture boxes on a form that had focus and moving them out of view.

  4. #4
    Addicted Member
    Join Date
    Aug 2002
    Location
    Baltimore, MD
    Posts
    230
    You can try using the Picture or StdPicture object instead.
    The Picture object enables you to manipulatebitmaps,icons,metafiles enhanced metafiles, GIF, and JPEG images assigned to objects having a Picture property.

    Syntax

    Picture

    Remarks

    You frequently identify a Picture object using the Picture property of an object that displays graphics (such as a Form object or a PictureBox control). If you have a PictureBox control named Picture1, you can set one Picture object equal to another using the Set statement, as in the following example:

    Dim X As Picture
    Set X = LoadPicture("PARTY.BMP")
    Set Picture1.Picture = X

    You can use an array of Picture objects to keep a series of graphics in memory without needing a form that contains multiple PictureBox or Image controls.

    You can not create a Picture object using code like Dim X As New Picture. If you want to create a Picture object, you must use the StdPicture object like this:

    Dim X As New StdPicture

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Oct 2001
    Location
    Florida
    Posts
    98
    Yes very true, i had thought about using the stdPicture variable; however, it didn't offer the options i need. The PictureBox variable does; however, you need a picturebox to use it from what i gather.

    I needed the .hDc extension for some functions which took the image pixel by pixel and roated and grey scaled the image.

    Again thank you all for your input as always it has been a great help and hopefuly to others as well.

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