473,396 Members | 2,009 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,396 software developers and data experts.

retrieving an image index on a label

This should be painfully simple but I have spent two days on it and I can't figure it out. I am NEW to vb.net, so please forgive my ignorance

I have a label that I assign an image to through an imagelist index

Label1.Image() = ImageList1.Images(3

This works fine and as expected. In the MouseEnter event I want to check the index of the imagelist to see what image is being displayed and possibly change it

If Label1.ImageIndex = 0 The
Label1.Image() = ImageList1.Images(3
Els
Label1.Image() = ImageList1.Images(0
End I

but this does not work. I ALWAYS get a 0 when I first enter the label then ALWAYS get a -1 from then on. If anyone can help I would greatly appreciate it

Thanks

To

Nov 20 '05 #1
3 3475
Cor
Hi Tom,

Can you try this?
\\\
Label1.Imagelist = ImageList1
Label1.Imageindex = 3
///

I think you do not set the imageindex you set the image.
(I never did it that way)
Label1.Image() = ImageList1.Images(3)

I hope this helps?
Cor
Nov 20 '05 #2
Tom,

* "=?Utf-8?B?VG9tIEZvc3Rlcg==?=" <an*******@discussions.microsoft.com> scripsit:
I have a label that I assign an image to through an imagelist index;

Label1.Image() = ImageList1.Images(3)


Instead of doing that, assign the imagelist to the control's 'ImageList'
property and then set its 'ImageIndex' property to 3. Alternatively you
can loop through the images in the imagelist and compare them to the
label's image by using "If Label1.Image Is ImageList1.Images(i)
Then...'.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #3
THANKS! That took care of it. I knew it was something simple that I was overlooking

Nov 20 '05 #4

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

Similar topics

1
by: midtoad | last post by:
I'm trying to display a GIF image in a label as the central area to a Tkinter GUI. The image does not appear, though a space is made for it. Why is this so? I notice that I can display a GIF...
2
by: Tyrone Slothrop | last post by:
I am coding a site which involves uploading images. All of the PHP and display is OK but the client wants to be able to display the image thumbnail on the upload page and show the full image on...
5
by: Haydnw | last post by:
Hi, I have the code below as code-behind for a page which displays two images. My problem is with the second bit of code, commented as " 'Portfolio image section". Basically, the SQL query gets...
1
by: Thubaiti | last post by:
Hi, I have an image web control with other web controls.. <asp:Image id="itemImage" runat="server"></asp:Image> <asp:Label id="itemNameLabel" runat="server"></asp:Label> <asp:Label...
39
by: jcrouse | last post by:
I am using the following code to get a background image for my form Private Sub mnuBgroundImage_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuBgroundImage.Clic If...
0
by: Andrew | last post by:
Hello Ive been messing around with a simple raw image viewer using Pil and Tkinter However I am running into problems displaying the images they appear to be not correct I believe it is cause of...
20
by: fatfatpopo | last post by:
Anyone who understand the codes below, can you please kindly explain to me by adding comments.. thanks in advance // <applet code="ImageSlider" width="400" height="400"></applet> import...
3
by: Nebulism | last post by:
Hi everyone, I am working on a module for my GUI that shows one image with an index value below and would use a scrollbar to control which of the images are displayed. The images are stored in a...
0
by: comdec | last post by:
I am using a webtree control to control events on the web page. My problem is when I click on a child in the webtree I can identify the index, but I am having a problem posting that index to the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
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,...

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.