|
-
Sep 12th, 2002, 12:14 PM
#1
Thread Starter
Lively Member
Picture Box Variable Usage?? *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:
Dim Picture1Temp As PictureBox
Dim picture2Temp As PictureBox
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:59 AM.
-
Sep 12th, 2002, 12:27 PM
#2
PowerPoster
You must SET your object variable to an object first - until that it's just an object variable.
Set picture2Temp = Me.Controls.Ad("VB.Picturebox", "Picture1")
picture2Temp .Move 0, 0
picture2Temp .Visible = True
Also you may declare it as follows:
Dim WithEvents picture2Temp As PictureBox
Roy
-
Sep 12th, 2002, 12:29 PM
#3
N/M this post... IROY got in b4 me....
The short answer is "no"
The slightly longer answer is .. it doesn't work (as is) because all you have done is declare a variable of TYPE PictureBox... the PictureBox doesn't actualy exist tho...
The even longer answer is.... there is a way to dynamicaly load controls at run time (two ways that I am aware of). Either way would allow you to create the pic box and then load into it. Search http://msdn.microsoft.com for Adding Controls at Runtime.
-
Sep 12th, 2002, 12:29 PM
#4
yup.. so what IROY55 is saying is that you need at least one control on your form... just don't set it to visible if you don't want to see it...
and there are no UDP packets here
-
Sep 12th, 2002, 12:52 PM
#5
Thread Starter
Lively Member
Ahhhh!!!
Thanks much for all the information 
We currently had a program that took a file, rotated it and turned the image to black and white using a Dll file. However that DLL turns out to create a nice little memory leak.
So instead I load a picture into a picture box, rotate it and change ech pixel to Black and white and put those pixels in the next picture box.
Was mostly trying to figure out a way to do this without actually having the form open with picture boxes out and such. IE in the background so the user can go about their business doing whatever users do when users sit in front of computers
-
Sep 12th, 2002, 01:01 PM
#6
Originally posted by TheVoid
Was mostly trying to figure out a way to do this without actually having the form open with picture boxes out and such. IE in the background so the user can go about their business doing whatever users do when users sit in front of computers
the form does not have to be visible either
-
Sep 13th, 2002, 07:58 AM
#7
Thread Starter
Lively Member
Thanks everyone for the input although if you remember your always supposed to give the answer we want to hear 
Ended up putting two picture boxes on the form, and moving them basically off the form and out of view, then let them do their thing.
Thanks again for all the quick responses.
Dust and ashes my friends DUST! and ashes!
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
|