473,698 Members | 2,524 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Referencing Images...

Tom
I need to be able to reference some images stored in my VB.NET program.
Normally, I would load the images into an ImageList control and use
them from there (these are going to be icons). However, I need to be
able to add/delete images from this image 'store' (whatever I end up
using); but because an image list only allows referencing by image
number in the list, when I would delete an image/icon it would 'mess'
up the ones following that because obviously the image number would
change. Also, I want to allow the user to load custom images/icons of
their own, which again (especially when deleting images) would allow
things to get screwed up because the image number would be affected
(i.e. in the program I would allows my main database records to 'store'
the key to an image - if that key is simply the image number in the
image list, then it is going to be incorrect if any image before that
gets deleted).

In the old VB 6 ImageList one could assign each image a 'key' - but
that isn't used in the new .NET image list. There has got to be a way
to store some kind of unique key to an image and then use that key
(perhaps a hash list or something). Anyone got a good way to handle
this? THanks in advance.

Chimp

--

May 23 '06 #1
2 3837
You can use a Dictionary to do this, assigning some key and storing Images:

Imports System.Collecti ons.Generics

....

Private m_Images As New Dictionary(Of Integer, Image)
....
....
Images .Add ( 21, theImage )
....
....
myImage = Images ( 21 )
....
....
Images .Remove ( 21 )
....
....


"Tom" <to*@nospam.com > wrote in message
news:ew******** ******@TK2MSFTN GP03.phx.gbl...
I need to be able to reference some images stored in my VB.NET program.
Normally, I would load the images into an ImageList control and use
them from there (these are going to be icons). However, I need to be
able to add/delete images from this image 'store' (whatever I end up
using); but because an image list only allows referencing by image
number in the list, when I would delete an image/icon it would 'mess'
up the ones following that because obviously the image number would
change. Also, I want to allow the user to load custom images/icons of
their own, which again (especially when deleting images) would allow
things to get screwed up because the image number would be affected
(i.e. in the program I would allows my main database records to 'store'
the key to an image - if that key is simply the image number in the
image list, then it is going to be incorrect if any image before that
gets deleted).

In the old VB 6 ImageList one could assign each image a 'key' - but
that isn't used in the new .NET image list. There has got to be a way
to store some kind of unique key to an image and then use that key
(perhaps a hash list or something). Anyone got a good way to handle
this? THanks in advance.

Chimp

--

May 24 '06 #2
On Tue, 23 May 2006 13:54:21 -0700, "Tom" <to*@nospam.com > wrote:
I need to be able to reference some images stored in my VB.NET program.
Normally, I would load the images into an ImageList control and use
them from there (these are going to be icons). However, I need to be
able to add/delete images from this image 'store' (whatever I end up
using); but because an image list only allows referencing by image
number in the list, when I would delete an image/icon it would 'mess'
up the ones following that because obviously the image number would
change. Also, I want to allow the user to load custom images/icons of
their own, which again (especially when deleting images) would allow
things to get screwed up because the image number would be affected
(i.e. in the program I would allows my main database records to 'store'
the key to an image - if that key is simply the image number in the
image list, then it is going to be incorrect if any image before that
gets deleted).

In the old VB 6 ImageList one could assign each image a 'key' - but
that isn't used in the new .NET image list. There has got to be a way
to store some kind of unique key to an image and then use that key
(perhaps a hash list or something). Anyone got a good way to handle
this? THanks in advance.

Chimp


If you manage to add images in Design to an ImageList componet
(doesn't work, here), you should be able to add keys at runtime:

ImageList1.Imag es.SetKeyName(i ndex, "SomeKey")

By your description, it may better to simply populate the ImageList at
runtime:
ImageList1.Imag es.Add("SomeKey ", SomeImage)

To delete:
ImageList1.Imag es.RemoveByKey( "SomeKey")

Gene
May 25 '06 #3

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

Similar topics

2
8051
by: Simon | last post by:
Am using the following code. <script language="JavaScript1.2"> function setquantity(productindex,productquantity) { //create the reference object irefname_none = eval("document." + productindex + "none"); <snip>
1
2001
by: Lucanus | last post by:
Hi All, Just a quick question, which should have a simple answer... Can I have a document with three images with the same name, and reference those images individually. ie: <img name="picture" src="file1.jpg"> <img name="picture" src="file2.jpg">
2
1416
by: RWC | last post by:
Hello, I have a page connected to an SQL table. The page loops through, creating a row for each record, displaying in image, the ID of which is set to the record id. When I click a button to change the image, I'd like to refer to the ID on the main page, but change the image on the main page. Any idea how to do this? Example is as follows
6
2471
by: Mikey_Doc | last post by:
Hi We are running cms 2002, Framework 1.0 with Visual studio 2002. We have just upgraded to Framework 1.1 and visual studio 2003. All of our database connection strings are stored within the machine config, this was necessary as our web site has 4 environments and the database server has a different name in each. Since the upgrade the applications can't read the strings in the
1
1975
by: WB | last post by:
Hi, I would like to do something like this page: http://www.stocklayouts.com/Products/Postcard/Postcard-Template-Design-Library.aspx?kwid=38 Notice when you mouse-over any of the icons under each thumbnail, a little description will appear to tell you what the icon is for. Okay, so I have a DataList in a stucture like this: <asp:DataList ID="DlsBrochures" runat="server" RepeatDirection="Horizontal">
2
1458
by: oroojo | last post by:
Hi i have the following code that works fine in firefox but not IE? function imgLoad () { test = new Image(); test = "../gfx/nav_es/areas_over.gif"; document.getElementById('test').src = test; } <body onLoad="imgLoad()">
3
1612
by: Torsten Wiebesiek | last post by:
Hi folks, currently I'm writing image classes for easier handling of Intel's IPP library. My idea is to have to different classes. One class that represents a complete image and deals with all the memeory management stuff, and another class, that is only a tile of the image. Let's call the first MemoryImage, and the second ReferenceImage. My code works well for creating non const and const reference images to a non
6
1377
by: wangers16 | last post by:
Hi all, I have the following array with which I need to reference to the second item in every array and write it out onto the page, how can this be done? var arr = new Array(); arr = 'images/001.jpg','Image 1 Description SECOND ITEM'; arr = 'images/002.jpg','Image 2 Description SECOND ITEM';
0
8678
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
8609
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9030
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8871
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7737
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
6525
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
5861
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();...
1
3052
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2007
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.