473,795 Members | 2,967 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Simple? Query the contents of an Imagebox


I have an image box I set like this:

image1.image = my.resources.ye s

or

image1.image = my.resources.no

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

Neither

image1.image is my.resources.ye s

or

image1.image.eq uals(my.resourc es.yes)

work.

Can anybody help?

Thanks

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

image1.image = my.resources.ye s

or

image1.image = my.resources.no

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

Neither

image1.image is my.resources.ye s

or

image1.image.eq uals(my.resourc es.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...@free net.dewrote:
"Phillip Taylor" <Phillip.Ross.T ay...@gmail.com schrieb


I have an image box I set like this:
image1.image = my.resources.ye s
or
image1.image = my.resources.no
How can I query which image is in the box later?
Neither
image1.image is my.resources.ye s
or
image1.image.eq uals(my.resourc es.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.<a uto_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 OnEnabledChange d
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.com schrieb
On Dec 3, 5:47 pm, "Armin Zingler" <az.nos...@free net.dewrote:
"Phillip Taylor" <Phillip.Ross.T ay...@gmail.com schrieb


I have an image box I set like this:
image1.image = my.resources.ye s
or
image1.image = my.resources.no
How can I query which image is in the box later?
Neither
image1.image is my.resources.ye s
or
image1.image.eq uals(my.resourc es.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.<a uto_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
OnEnabledChange d
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...@free net.dewrote:
"Phillip Taylor" <Phillip.Ross.T ay...@gmail.com schrieb
On Dec 3, 5:47 pm, "Armin Zingler" <az.nos...@free net.dewrote:
"Phillip Taylor" <Phillip.Ross.T ay...@gmail.com schrieb
I have an image box I set like this:
image1.image = my.resources.ye s
or
image1.image = my.resources.no
How can I query which image is in the box later?
Neither
image1.image is my.resources.ye s
or
image1.image.eq uals(my.resourc es.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.<a uto_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
OnEnabledChange d
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.ra wformat.equals( my.resources.ye s.rawformat)

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.T ay...@gmail.com >
wrote:
On Dec 3, 7:00 pm, "Armin Zingler" <az.nos...@free net.dewrote:
"Phillip Taylor" <Phillip.Ross.T ay...@gmail.com schrieb
On Dec 3, 5:47 pm, "Armin Zingler" <az.nos...@free net.dewrote:
"Phillip Taylor" <Phillip.Ross.T ay...@gmail.com schrieb
I have an image box I set like this:
image1.image = my.resources.ye s
or
image1.image = my.resources.no
How can I query which image is in the box later?
Neither
image1.image is my.resources.ye s
or
image1.image.eq uals(my.resourc es.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.<a uto_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
OnEnabledChange d
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.ra wformat.equals( my.resources.ye s.rawformat)

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.T ay...@gmail.com >
wrote:
On Dec 4, 10:28 am, Phillip Taylor <Phillip.Ross.T ay...@gmail.com >
wrote:
On Dec 3, 7:00 pm, "Armin Zingler" <az.nos...@free net.dewrote:
"Phillip Taylor" <Phillip.Ross.T ay...@gmail.com schrieb
On Dec 3, 5:47 pm, "Armin Zingler" <az.nos...@free net.dewrote:
"Phillip Taylor" <Phillip.Ross.T ay...@gmail.com schrieb
I have an image box I set like this:
image1.image = my.resources.ye s
or
image1.image = my.resources.no
How can I query which image is in the box later?
Neither
image1.image is my.resources.ye s
or
image1.image.eq uals(my.resourc es.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.<a uto_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
OnEnabledChange d
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.ra wformat.equals( my.resources.ye s.rawformat)
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 CompareTwoImage s(ByRef image1 As Image, ByRef
image2 As Image) As Boolean

If (image1.Height <image2.Heigh t) 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.com schrieb
>
I've written it myself now. Thanks for the help earlier. The benefit
of everyone this is the code:

Public Function CompareTwoImage s(ByRef image1 As Image, ByRef
image2 As Image) As Boolean

If (image1.Height <image2.Heigh t) 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.ye s

or

image1.image = my.resources.no

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

Neither

image1.image is my.resources.ye s

or

image1.image.eq uals(my.resourc es.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.ye s
or
image1.image = my.resources.no
How can I query which image is in the box later?
Neither
image1.image is my.resources.ye s
or
image1.image.eq uals(my.resourc es.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
1257
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 selecting "sample contents". But it seems it give me back a read only view. Is there a way to change the contents via the gui? Thanks.
5
2219
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 1,1,2,4. I have narrowed it down to the sort function. I'm almost positive
2
1451
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
4625
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 = $doc->loadHTMLFile("./aBasicSearchResult.html"); if ( $res == true ) { $zip = $doc->getElementById('zipRaw_id')->value; if ( 0 != $zip ) {
2
1361
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 is that it seems to be cached even if I make a change to the stored procedure. For example I changed a string literal in the proc and it was completely ignored then next time I viewed the page.
1
2704
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 Len(Nz(Me.txtPHOTOFILENAME.Value, "")) <0 Then 'File name exists If Len(Dir$(strPicFolderPath + Me!)) <0 Then 'File found Me!.Picture = strPicFolderPath +
2
3198
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: Query failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '>function.extract]: First argument should be an array in functions.inc.php on line 31
3
1753
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 data in a table is: ID - INFO --- - -------- 10 - ten
1
1447
by: Sumamadhavanitpark | last post by:
1.loading image in to imagebox using http 2. help for ADrotator
0
9672
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10436
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10163
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9040
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7538
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6780
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5436
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5563
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2920
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.