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

Image List

Hi all
Is there any limit of images which can be added to a image list. I
have a problem with this control. I added an image list in design mode
and I am adding images using code. Then I want to use images in a
listview, and each time I am trying to call an image at index 15 or
above I have an error stating that there isn't any object at that
index. I was debbuging it and there was more there was 22 images, but
only 15 I can load.

Is there any way I can add and display more than 15 images. What is
causing that problem?

Thanks

Mar 8 '07 #1
3 2816
I doubt there is a limit, but it would probably help us if you posted your
code
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

<gr************@googlemail.comwrote in message
news:11**********************@c51g2000cwc.googlegr oups.com...
Hi all
Is there any limit of images which can be added to a image list. I
have a problem with this control. I added an image list in design mode
and I am adding images using code. Then I want to use images in a
listview, and each time I am trying to call an image at index 15 or
above I have an error stating that there isn't any object at that
index. I was debbuging it and there was more there was 22 images, but
only 15 I can load.

Is there any way I can add and display more than 15 images. What is
causing that problem?

Thanks

Mar 8 '07 #2
You can have more than 15 images in an imagelist control.

Not sure of the limitations but way more than 15 I think I had 200 or so
(they were only littel 32x32 icons though)

Mike.
<gr************@googlemail.comwrote in message
news:11**********************@c51g2000cwc.googlegr oups.com...
Hi all
Is there any limit of images which can be added to a image list. I
have a problem with this control. I added an image list in design mode
and I am adding images using code. Then I want to use images in a
listview, and each time I am trying to call an image at index 15 or
above I have an error stating that there isn't any object at that
index. I was debbuging it and there was more there was 22 images, but
only 15 I can load.

Is there any way I can add and display more than 15 images. What is
causing that problem?

Thanks

Mar 8 '07 #3
On 8 Mar, 23:26, "Nathan Sokalski" <njsokal...@hotmail.comwrote:
I doubt there is a limit, but it would probably help us if you posted your
code
--
Nathan Sokalski
njsokal...@hotmail.comhttp://www.nathansokalski.com/

<grzegorz.ga...@googlemail.comwrote in message

news:11**********************@c51g2000cwc.googlegr oups.com...
Hi all
Is there any limit of images which can be added to a image list. I
have a problem with this control. I added an image list in design mode
and I am adding images using code. Then I want to use images in a
listview, and each time I am trying to call an image at index 15 or
above I have an error stating that there isn't any object at that
index. I was debbuging it and there was more there was 22 images, but
only 15 I can load.
Is there any way I can add and display more than 15 images. What is
causing that problem?
Thanks
Ok I am posting some code

Dim imgFlag As Image

sCountry = LookUpDetails(row("ip").ToString)
newRow = dsReport.Tables("Countries").Rows.Find(sCountry)
If newRow Is Nothing Then
newRow = dsReport.Tables("Countries").NewRow
newRow("CountryName") = sCountry
newRow("CountryHits") = CInt(row("hits").ToString)
newRow("CountryVisitors") = 1
newRow("CountryCode") =
LookUpCountryCode(row("ip").ToString)
Try
'Adding image to ImageList
imgFlag = Image.FromFile(sImagePath &
newRow("CountryCode").ToString.ToLower & ".gif")

ilCountries.Images.Add(newRow("CountryCode").ToStr ing, imgFlag)

Catch ex As IO.FileNotFoundException
EventLog.WriteEntry("LogAnalyst", "Image file was
not found. Path for desired image: " & sImagePath &
newRow("CountryCode").ToString.ToLower & ".gif",
EventLogEntryType.Error, 100)
End Try

dsReport.Tables("Countries").Rows.Add(newRow)
Else
newRow("CountryHits") += CInt(row("hits").ToString)
newRow("CountryVisitors") += 1
End If

And another bit where error appears

Dim item As ListViewItem

If rows.Length 0 Then
StatAnalyst.ListView2.StateImageList =
StatAnalyst.ilCountries
For Each row In rows
item = New
ListViewItem(row("CountryName").ToString)
Try
item.StateImageIndex =
StatAnalyst.ilCountries.Images.IndexOfKey(row("Cou ntryCode").ToString)
Catch
End Try
item.SubItems.Add(row("CountryHits").ToString)
item.SubItems.Add(row("CountryVisitors").ToString)
StatAnalyst.ListView2.Items.Add(item)
Next
End If

Error message from exception:
System.ArgumentOutOfRangeException: InvalidArgument=Value of '21' is
not valid for 'StateImageIndex'.
Parameter name: StateImageIndex
at System.Windows.Forms.ListViewItem.set_StateImageIn dex(Int32
value)
at Stat_Analyzer.Reports.CreateCountries() in Path\Stat Analyzer
\Stat Analyzer\Reports.vb:line 112

At the moment when error appears there are 22 images in ListView. On
ListView only 15 are displayed properly, only 15 appeared.

I have the same problem with another ListView in which I have 16
items. That list was created using design mode, but when I was trying
to add image from index 15 I got the same error as above.

Mar 9 '07 #4

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

Similar topics

3
by: dave | last post by:
Hello there, I am at my wit's end ! I have used the following script succesfully to upload an image to my web space. But what I really want to be able to do is to update an existing record in a...
1
by: Desigan Chinniah | last post by:
I am presently trying to display a list of items INLINE using an image as a seperator..... and having difficulties.... See below for 3 seperate sets of html and css files. Each set does something...
6
by: Haines Brown | last post by:
I find that when I use list-style-image with galeon or mozilla, padding is inserted between the symbol image and the following list text, while under IE 5.0 it seems to be inserted before the image...
1
by: Ronny | last post by:
Hi, When ever I use image lists in a tree view the image list is behaving inconsistent. When I add images they first look good and clean, after I have close and open the code in the IDE the...
4
by: Gabriella | last post by:
hi, I am writing a simple bulleted list with ul/li, with my image as the list-style-image, and for some reason the image bullet on IE only (FF is fine) is vertically aligned to the top. Meaning,...
4
by: Mark | last post by:
Hi I notice that in some cases, to get an icon, an object (for example a list view) uses an image list, in others (e.g. a form) the image is selected from the project resources, i.e. a file. ...
6
by: Rob | last post by:
Hello, I'm sure this has come up before. I have need for a collection of all elements/objects in an HTML document that have any kind of an attribute (HTML or CSS) that is making use of a URL to...
5
by: Roy Smith | last post by:
Be kind to me, I'm a CSS newbie... I've been playing with drupal, building a web site (hyc-test.org). I started with the "sky" theme, but didn't like the way it rendered list items in menus. ...
0
by: Lou O | last post by:
I have browsed and seen several posts on the subject but my issue seems to be unique. I have an image control on a form that updates on the after update event of a list box on the control. For...
1
by: Angelo | last post by:
Hi all, I am having a very annoying problem when using an unordered list in my aspx page. I set a UL style to use a custom image as the list style image but it does not show in the screen. I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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
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...
0
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...
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.