corientdev / imagelistview

Automatically exported from code.google.com/p/imagelistview
1 stars 0 forks source link

Error when adding items #156

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Firstly, awesome work. Very nice!

What steps will reproduce the problem?
1. Create a form with a ImageListView control named ImageListView1
2. Add the code:
Private Sub LoadItem(ByVal Title As String, ByVal Group As String, ByVal 
Thumbnail As System.Drawing.Image)
        Dim NewItem As New Manina.Windows.Forms.ImageListViewItem
        NewItem.Text = Title
        ImageListView1.Items.Add(NewItem, Thumbnail)
        NewItem.SetSubItemText(0, Group)
End Sub
3. When I call LoadItem an error occurs on the Items.Add function "Index and 
length must refer to a location within the string. Parameter name: length"

What is the expected output? What do you see instead?
I have tried adding items using various methods with the same result. 

What version of the product are you using? On what operating system?
Version 11.0, Win7, VS2008

Please provide any additional information below.
I need to create items that are not referring to actual files and manually add 
the thumbnails but have not had much success. I would REALLY appreciate your 
help.

Thanks,
Quentin

Original issue reported on code.google.com by QuentinG...@gmail.com on 26 Oct 2012 at 1:43

GoogleCodeExporter commented 9 years ago
Did you create the custom column before calling your LoadItem method? e.g:

ImageListView1.Columns.Add(ColumnType.Custom, "My Group Column")

Otherwise can you please post the stack trace?

Thanks,
Ozgur

Original comment by oozcitak on 30 Oct 2012 at 8:33

GoogleCodeExporter commented 9 years ago
Hi,
Thanks for your help.
Yes, I had added the custom column and in fact it seems that this is what is 
causing the problem. If I call SetSubItemText on a column that is a custom type 
it throws an index out of range error. If the column type is set to something 
else I seem to get no errors.
It is easy to replicate the error - Create a form, add an ImageListView object. 
Add the following to the form's onload event:
        Me.ImageListView1.Columns.Add(Manina.Windows.Forms.ColumnType.Custom, "My Column")
        Me.ImageListView1.Items.Add("C:\Users\Quentin\Dropbox\My Pictures\200512221836_00039.jpg")
        Me.ImageListView1.Items(0).SetSubItemText(0, "Blah")
When it is run an error occurs on and Items.Add method with the following stack 
trace:

    at System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean fAlwaysCopy)
   at System.String.Substring(Int32 startIndex, Int32 length)
   at Manina.Windows.Forms.Utility.GroupTextAlpha(String text)
   at Manina.Windows.Forms.ImageListViewItem.UpdateGroup(ImageListViewColumnHeader column)
   at Manina.Windows.Forms.ImageListView.ImageListViewItemCollection.Sort()
   at Manina.Windows.Forms.ImageListView.ImageListViewItemCollection.AddRemoveGroupItem(Int32 index, Boolean add)
   at Manina.Windows.Forms.ImageListView.ImageListViewItemCollection.InsertInternal(Int32 index, ImageListViewItem item, ImageListViewItemAdaptor adaptor)
   at Manina.Windows.Forms.ImageListView.ImageListViewItemCollection.AddInternal(ImageListViewItem item, ImageListViewItemAdaptor adaptor)
   at Manina.Windows.Forms.ImageListView.ImageListViewItemCollection.Add(ImageListViewItem item, ImageListViewItemAdaptor adaptor)
   at Manina.Windows.Forms.ImageListView.ImageListViewItemCollection.Add(ImageListViewItem item)
   at Manina.Windows.Forms.ImageListView.ImageListViewItemCollection.Add(String filename, Image initialThumbnail)
   at Manina.Windows.Forms.ImageListView.ImageListViewItemCollection.Add(String filename)
   at WindowsApplication1.Form1.Form1_Load(Object sender, EventArgs e) in C:\Users\Quentin\AppData\Local\Temporary Projects\WindowsApplication1\Form1.vb:line 4

Regards,
Quentin

Original comment by QuentinG...@gmail.com on 30 Oct 2012 at 12:50

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r691.

Original comment by oozcitak on 31 Oct 2012 at 10:31