473,323 Members | 1,574 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,323 software developers and data experts.

Simple? Query the contents of an Imagebox


I have an image box I set like this:

image1.image = my.resources.yes

or

image1.image = my.resources.no

How can I query which image is in the box later?

Neither

image1.image is my.resources.yes

or

image1.image.equals(my.resources.yes)

work.

Can anybody help?

Thanks

Phill
Dec 3 '07 #1
9 1130
"Phillip Taylor" <Ph*****************@gmail.comschrieb
>
I have an image box I set like this:

image1.image = my.resources.yes

or

image1.image = my.resources.no

How can I query which image is in the box later?

Neither

image1.image is my.resources.yes

or

image1.image.equals(my.resources.yes)

work.

Can anybody help?

The generated code is wrong. "Yes" must have been a function, not a
property. A property indicates that each time the same image is returned. In
fact, a new Image is created every time. Therefore, comparing the image in
the Control to the new Image from the ressource, will always return False.

Remember which image you assigned in a separate variable.
Armin

Dec 3 '07 #2
On Dec 3, 5:47 pm, "Armin Zingler" <az.nos...@freenet.dewrote:
"Phillip Taylor" <Phillip.Ross.Tay...@gmail.comschrieb


I have an image box I set like this:
image1.image = my.resources.yes
or
image1.image = my.resources.no
How can I query which image is in the box later?
Neither
image1.image is my.resources.yes
or
image1.image.equals(my.resources.yes)
work.
Can anybody help?

The generated code is wrong. "Yes" must have been a function, not a
property. A property indicates that each time the same image is returned. In
fact, a new Image is created every time. Therefore, comparing the image in
the Control to the new Image from the ressource, will always return False.

Remember which image you assigned in a separate variable.

Armin
It's got the property icon. What's more, it's generated automatically
from the properties page for the project. (The resources tab - each
resource gets a name under My.Resources.<auto_generated>). I
understand what your saying about the references not lining up because
it's not the same instance of the object.

However, it's basically flat out impossible for me to store the
original image description in a seperate variable. This is some of the
most complex code I've written and it's well tested so I can't afford
to change it and get it wrong. I don't want to get into the symantecs
of what the code does or whether it's good coding but basically I
cannot modify the code in the way you have suggested, which is a
shame.

However, let me explain what I'm trying to do. I have a user control I
wrote myself. When it is disabled, the images within the control do
not change. They still look colourful like this could be clicked on.
What I'm really going for is to have my controls OnEnabledChanged
value toggle between colourful and "Greyscale" style images but I
cannot compare the image to it's original value. Can anyone help
please?
Dec 3 '07 #3
"Phillip Taylor" <Ph*****************@gmail.comschrieb
On Dec 3, 5:47 pm, "Armin Zingler" <az.nos...@freenet.dewrote:
"Phillip Taylor" <Phillip.Ross.Tay...@gmail.comschrieb


I have an image box I set like this:
image1.image = my.resources.yes
or
image1.image = my.resources.no
How can I query which image is in the box later?
Neither
image1.image is my.resources.yes
or
image1.image.equals(my.resources.yes)
work.
Can anybody help?
The generated code is wrong. "Yes" must have been a function, not
a property. A property indicates that each time the same image is
returned. In fact, a new Image is created every time. Therefore,
comparing the image in the Control to the new Image from the
ressource, will always return False.

Remember which image you assigned in a separate variable.

Armin

It's got the property icon. What's more, it's generated
automatically from the properties page for the project. (The
resources tab - each resource gets a name under
My.Resources.<auto_generated>). I
understand what your saying about the references not lining up
because it's not the same instance of the object.

However, it's basically flat out impossible for me to store the
original image description in a seperate variable. This is some of
the most complex code I've written and it's well tested so I can't
afford to change it and get it wrong. I don't want to get into the
symantecs of what the code does or whether it's good coding but
basically I
cannot modify the code in the way you have suggested, which is a
shame.

However, let me explain what I'm trying to do. I have a user control
I wrote myself. When it is disabled, the images within the control
do not change. They still look colourful like this could be clicked
on. What I'm really going for is to have my controls
OnEnabledChanged
value toggle between colourful and "Greyscale" style images but I
cannot compare the image to it's original value. Can anyone help
please?
If you wanted to compare images, you had to compare each pixel. In the Image
property, you will never know where it originally came from. As this
information is not available, you have to remember it anywhere.

Why do you need to know where the image came from? If you want to create a
grayscale image, you can take the image from the Image property.
Armin

Dec 3 '07 #4
On Dec 3, 7:00 pm, "Armin Zingler" <az.nos...@freenet.dewrote:
"Phillip Taylor" <Phillip.Ross.Tay...@gmail.comschrieb
On Dec 3, 5:47 pm, "Armin Zingler" <az.nos...@freenet.dewrote:
"Phillip Taylor" <Phillip.Ross.Tay...@gmail.comschrieb
I have an image box I set like this:
image1.image = my.resources.yes
or
image1.image = my.resources.no
How can I query which image is in the box later?
Neither
image1.image is my.resources.yes
or
image1.image.equals(my.resources.yes)
work.
Can anybody help?
The generated code is wrong. "Yes" must have been a function, not
a property. A property indicates that each time the same image is
returned. In fact, a new Image is created every time. Therefore,
comparing the image in the Control to the new Image from the
ressource, will always return False.
Remember which image you assigned in a separate variable.
Armin
It's got the property icon. What's more, it's generated
automatically from the properties page for the project. (The
resources tab - each resource gets a name under
My.Resources.<auto_generated>). I
understand what your saying about the references not lining up
because it's not the same instance of the object.
However, it's basically flat out impossible for me to store the
original image description in a seperate variable. This is some of
the most complex code I've written and it's well tested so I can't
afford to change it and get it wrong. I don't want to get into the
symantecs of what the code does or whether it's good coding but
basically I
cannot modify the code in the way you have suggested, which is a
shame.
However, let me explain what I'm trying to do. I have a user control
I wrote myself. When it is disabled, the images within the control
do not change. They still look colourful like this could be clicked
on. What I'm really going for is to have my controls
OnEnabledChanged
value toggle between colourful and "Greyscale" style images but I
cannot compare the image to it's original value. Can anyone help
please?

If you wanted to compare images, you had to compare each pixel. In the Image
property, you will never know where it originally came from. As this
information is not available, you have to remember it anywhere.

Why do you need to know where the image came from? If you want to create a
grayscale image, you can take the image from the Image property.

Armin
I fixed Armin!!!!

I use image1.image.rawformat.equals(my.resources.yes.raw format)

Thanks for your help dude, that got my cogs turning!

Phill
Dec 4 '07 #5
On Dec 4, 10:28 am, Phillip Taylor <Phillip.Ross.Tay...@gmail.com>
wrote:
On Dec 3, 7:00 pm, "Armin Zingler" <az.nos...@freenet.dewrote:
"Phillip Taylor" <Phillip.Ross.Tay...@gmail.comschrieb
On Dec 3, 5:47 pm, "Armin Zingler" <az.nos...@freenet.dewrote:
"Phillip Taylor" <Phillip.Ross.Tay...@gmail.comschrieb
I have an image box I set like this:
image1.image = my.resources.yes
or
image1.image = my.resources.no
How can I query which image is in the box later?
Neither
image1.image is my.resources.yes
or
image1.image.equals(my.resources.yes)
work.
Can anybody help?
The generated code is wrong. "Yes" must have been a function, not
a property. A property indicates that each time the same image is
returned. In fact, a new Image is created every time. Therefore,
comparing the image in the Control to the new Image from the
ressource, will always return False.
Remember which image you assigned in a separate variable.
Armin
It's got the property icon. What's more, it's generated
automatically from the properties page for the project. (The
resources tab - each resource gets a name under
My.Resources.<auto_generated>). I
understand what your saying about the references not lining up
because it's not the same instance of the object.
However, it's basically flat out impossible for me to store the
original image description in a seperate variable. This is some of
the most complex code I've written and it's well tested so I can't
afford to change it and get it wrong. I don't want to get into the
symantecs of what the code does or whether it's good coding but
basically I
cannot modify the code in the way you have suggested, which is a
shame.
However, let me explain what I'm trying to do. I have a user control
I wrote myself. When it is disabled, the images within the control
do not change. They still look colourful like this could be clicked
on. What I'm really going for is to have my controls
OnEnabledChanged
value toggle between colourful and "Greyscale" style images but I
cannot compare the image to it's original value. Can anyone help
please?
If you wanted to compare images, you had to compare each pixel. In the Image
property, you will never know where it originally came from. As this
information is not available, you have to remember it anywhere.
Why do you need to know where the image came from? If you want to create a
grayscale image, you can take the image from the Image property.
Armin

I fixed Armin!!!!

I use image1.image.rawformat.equals(my.resources.yes.raw format)

Thanks for your help dude, that got my cogs turning!

Phill
no. i don't know what I'm talking about. that doesn't work
Dec 4 '07 #6
On Dec 4, 10:38 am, Phillip Taylor <Phillip.Ross.Tay...@gmail.com>
wrote:
On Dec 4, 10:28 am, Phillip Taylor <Phillip.Ross.Tay...@gmail.com>
wrote:
On Dec 3, 7:00 pm, "Armin Zingler" <az.nos...@freenet.dewrote:
"Phillip Taylor" <Phillip.Ross.Tay...@gmail.comschrieb
On Dec 3, 5:47 pm, "Armin Zingler" <az.nos...@freenet.dewrote:
"Phillip Taylor" <Phillip.Ross.Tay...@gmail.comschrieb
I have an image box I set like this:
image1.image = my.resources.yes
or
image1.image = my.resources.no
How can I query which image is in the box later?
Neither
image1.image is my.resources.yes
or
image1.image.equals(my.resources.yes)
work.
Can anybody help?
The generated code is wrong. "Yes" must have been a function, not
a property. A property indicates that each time the same image is
returned. In fact, a new Image is created every time. Therefore,
comparing the image in the Control to the new Image from the
ressource, will always return False.
Remember which image you assigned in a separate variable.
Armin
It's got the property icon. What's more, it's generated
automatically from the properties page for the project. (The
resources tab - each resource gets a name under
My.Resources.<auto_generated>). I
understand what your saying about the references not lining up
because it's not the same instance of the object.
However, it's basically flat out impossible for me to store the
original image description in a seperate variable. This is some of
the most complex code I've written and it's well tested so I can't
afford to change it and get it wrong. I don't want to get into the
symantecs of what the code does or whether it's good coding but
basically I
cannot modify the code in the way you have suggested, which is a
shame.
However, let me explain what I'm trying to do. I have a user control
I wrote myself. When it is disabled, the images within the control
do not change. They still look colourful like this could be clicked
on. What I'm really going for is to have my controls
OnEnabledChanged
value toggle between colourful and "Greyscale" style images but I
cannot compare the image to it's original value. Can anyone help
please?
If you wanted to compare images, you had to compare each pixel. In the Image
property, you will never know where it originally came from. As this
information is not available, you have to remember it anywhere.
Why do you need to know where the image came from? If you want to create a
grayscale image, you can take the image from the Image property.
Armin
I fixed Armin!!!!
I use image1.image.rawformat.equals(my.resources.yes.raw format)
Thanks for your help dude, that got my cogs turning!
Phill

no. i don't know what I'm talking about. that doesn't work
I've written it myself now. Thanks for the help earlier. The benefit
of everyone this is the code:

Public Function CompareTwoImages(ByRef image1 As Image, ByRef
image2 As Image) As Boolean

If (image1.Height <image2.Height) Then Return False
If (image1.Width <image2.Width) Then Return False

'cast to bitmaps so we can have some functionality
Dim img1 As New Bitmap(image1)
Dim img2 As New Bitmap(image2)

'compare every single pixel individually.
For x As Int32 = 0 To img1.Width - 1
For y As Int32 = 0 To img1.Height - 1
If (img1.GetPixel(x, y) <img2.GetPixel(x, y)) Then
Return False
Next
Next

Return True
End Function
Dec 4 '07 #7
"Phillip Taylor" <Ph*****************@gmail.comschrieb
>
I've written it myself now. Thanks for the help earlier. The benefit
of everyone this is the code:

Public Function CompareTwoImages(ByRef image1 As Image, ByRef
image2 As Image) As Boolean

If (image1.Height <image2.Height) Then Return False
If (image1.Width <image2.Width) Then Return False

'cast to bitmaps so we can have some functionality
Dim img1 As New Bitmap(image1)
Dim img2 As New Bitmap(image2)

'compare every single pixel individually.
For x As Int32 = 0 To img1.Width - 1
For y As Int32 = 0 To img1.Height - 1
If (img1.GetPixel(x, y) <img2.GetPixel(x, y)) Then
Return False
Next
Next

Return True
End Function
Comparing all Pixels should not have been a suggestion. :-)

I don't understand why you don't simply remember which image you stored
instead of producing a lot of code that additionally costs a lot of
CPU power.
Armin

Dec 4 '07 #8
Phillip Taylor schreef:
I have an image box I set like this:

image1.image = my.resources.yes

or

image1.image = my.resources.no

How can I query which image is in the box later?

Neither

image1.image is my.resources.yes

or

image1.image.equals(my.resources.yes)

work.

Can anybody help?

Thanks

Phill
In the image1.tag indicate which one is active i.e.

....
image1.image=my.resources.no
image1.tag = "no"
....

You can use the tag to store any arbitrary information.

--
Rinze van Huizen
C-Services Holland b.v
Dec 4 '07 #9
On Dec 4 2007, 3:05 pm, "C-Services Holland b.v."
<cshNOSPAMPLE...@csh4u.nlwrote:
Phillip Taylor schreef:
I have an image box I set like this:
image1.image = my.resources.yes
or
image1.image = my.resources.no
How can I query which image is in the box later?
Neither
image1.image is my.resources.yes
or
image1.image.equals(my.resources.yes)
work.
Can anybody help?
Thanks
Phill

In the image1.tag indicate which one is active i.e.

...
image1.image=my.resources.no
image1.tag = "no"
...

You can use the tag to store any arbitrary information.

--
Rinze van Huizen
C-Services Holland b.v
I am refering to the Image object, not the PictureBox Component. It
does not have a Tag property.
Jan 29 '08 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Daniel Wang | last post by:
I am using the latest trial version of DB2 on Windows. I would like to modify the contents of a table and Control Center allows me to view the contents by right clicking on the table name...
5
by: ritchie | last post by:
Hi, I am writing to ask if anyone can see why my array is not being sorted correctly? It's an array of 4 elements(ints 1,2,3,4) but after calling the selection sort it comes back sorted as...
2
by: cyshao | last post by:
I opened an image and want to change its size, then display it in a ImageBox. How can I do that ? Thanks Charles Shao
27
by: one man army | last post by:
Hi All- I am new to PHP. I found FAQTS and the php manual. I am trying this sequence, but getting 'no zip string found:'... PHP Version 4.4.0 $doc = new DomDocument; $res =...
2
by: Simon Rigby | last post by:
Hi folks, ASP.NET2, Sql Server 2005 I have an app that executed a sql server query that produces an XML file used as the DateFile for an XMLDataSource bound to a TreeView. The bizarre thing...
1
by: ApexData | last post by:
I have an ImageBox with PictureType set to LINK. I have a string with a path strPicFolderPath = "C:\Pictures" In the OnCurrent event of the form I have this code: If...
2
by: Flic | last post by:
Hi, I have a basic db that I access with MySQL query browser. Everything seems fine to me but I am using this db as part of a php shopping basket and when I try to add an item I get: Notice:...
3
by: prabhas | last post by:
I want to swap two tuples in a table, using a single , simple query. No SELECT query allowed, no inner queries allowed. No PL/SQL allowed. Do you have any idea how to do this? e.g. my current...
1
by: Sumamadhavanitpark | last post by:
1.loading image in to imagebox using http 2. help for ADrotator
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.