none
.Images.SetKeyName designer generated code exception RRS feed

  • Question

  • I recently converted a solution from vs 2003 to 2005. On the main form i use a couple of imagelists.

    On every imagelist i use i get an exception on the designer generated code.

    Example:

    Me.IL_Treeview.ImageStream = CType(resources.GetObject("IL_Treeview.ImageStream"), System.Windows.Forms.ImageListStreamer)
    Me.IL_Treeview.TransparentColor = System.Drawing.Color.Transparent
    Me.IL_Treeview.Images.SetKeyName(0, "page.png")
    Me.IL_Treeview.Images.SetKeyName(1, "bricks.png")
    Me.IL_Treeview.Images.SetKeyName(2, "brick.png")
    Me.IL_Treeview.Images.SetKeyName(3, "cog.png")
    Me.IL_Treeview.Images.SetKeyName(4, "arrow_back.png")
    Me.IL_Treeview.Images.SetKeyName(5, "info.png")

    in this imagelist the exception is raised on the row:
    Me.IL_Treeview.Images.SetKeyName(4, "arrow_back.png")

    System.IndexOutOfRangeException was unhandled
      Message="Index was outside the bounds of the array."
      Source="System.Windows.Forms"
      StackTrace:
           at System.Windows.Forms.ImageList.ImageCollection.SetKeyName(Int32 index, String name)
           at JZL_JTool.FRM_Hoofdscherm.InitializeComponent() in C:\Development\JZL_JTool\FRM_Hoofdscherm.vb:line 473
           at JZL_JTool.FRM_Hoofdscherm..ctor() in C:\Development\JZL_JTool\FRM_Hoofdscherm.vb:line 14
           at JZL_JTool.startup.main(String[] sArgs) in C:\Development\JZL_JTool\startup.vb:line 112
           at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
           at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
           at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
           at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
           at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
           at System.Threading.ThreadHelper.ThreadStart()

    What can i do to resolve this issue?

    Wednesday, July 5, 2006 1:40 PM

All replies

  • Hi Jonny,

    The only thing that comes to my mind would be to verify that the ImageStream that you are loading as a resource does indeed have 6 images in it.

    Can you add the following code before you start setting the ImageKeys?

        MsgBox(Me.IL_Treeview.Images.Count.ToString())

    If the number is indeed 6, then there is a bug in the ImageList or ImageListStreamer class; otherwise your resource is missing some images.

    Hope this helps,

    Monday, July 10, 2006 4:38 AM
  •  MSFT Abel Valadez wrote:

    Can you add the following code before you start setting the ImageKeys?

        MsgBox(Me.IL_Treeview.Images.Count.ToString())

    If the number is indeed 6, then there is a bug in the ImageList or ImageListStreamer class; otherwise your resource is missing some images

    It counts 4. I'm not using a resource file and the solution worked (before the conversion) in VS 2003. Does anybody know at what point are the images loaded into the solution?

     

    Monday, July 10, 2006 9:18 AM
  • The following line is loading the resources that are specific to the imagelist:

    Me.IL_Treeview.ImageStream = CType(resources.GetObject("IL_Treeview.ImageStream"), System.Windows.Forms.ImageListStreamer)

    Can you do a "Find References" on "resources" and paste the code where it is declared and initialized?

    Best Regards,

    Monday, July 10, 2006 8:37 PM
  • It's declared in the same form:

    Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(FRM_Hoofdscherm)) - C:\Development\JZL_JTool\FRM_Hoofdscherm.vb(206, 13)

    Tuesday, July 11, 2006 11:34 AM
  • It looks like the resource is embedded into the same assembly, but I don't know exactly how to verify that assumption. I'll ask someone from the WinForms team to follow up with you.

    Best Regards, Abel.

    Tuesday, July 11, 2006 4:21 PM
  • Can you list the contents of the resx file that contains the imagelist?  You should be able to open the resx file for FRM_Hoofdscherm and see an xml tag for IL_Treeview.ImageStream.

    If you comment out the lines that cause the exception and the designer loads, can you edit the imagelist to see if all 6 images were loaded?

    Also, when you run the app, do you see all six images?

     

    Wednesday, July 12, 2006 7:55 PM
  • I moved the thread to winforms designer, which is a more appropriate place.
    Wednesday, July 12, 2006 7:58 PM
  •  Benjamin Wulfe - MS wrote:

    Can you list the contents of the resx file that contains the imagelist?  You should be able to open the resx file for FRM_Hoofdscherm and see an xml tag for IL_Treeview.ImageStream.

    If you comment out the lines that cause the exception and the designer loads, can you edit the imagelist to see if all 6 images were loaded?

    Also, when you run the app, do you see all six images?

     

    if i skip the lines in debug mode, the application runs normally, and all images are displayed.

    I'm not sure what to find in the resx file?

     <data name="IL_Treeview.ImageStream" mimetype="application/x-microsoft.net.object.binary.base64">
        <value>
            AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0yLjAuMC4w
            LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
            ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAADm
            GQAAAk1TRnQBSQFMAgEBBgEAAQkBAAEEAQABEAEAARABAAT/ASEBAAj/AUIBTQE2BwABNgMAASgDAAFA
            AwABIAMAAQEBAAEgBgABIP8A/wD/AP8AIgABBgIBAQYBWQICAbj4AAFdAQwBCAHZAVkBXQEyAfcBJwIB
            ATgsAAEDAgEBAwEiAgEBMAFdAgoB3wFpAjEB9AFwAkEB9wFrAkgB+QE6AgEBXgEtAgEBQwFsAiwB8gFw
            AkEB9wFpAjEB9AFdAgoB3wEiAgEBMAEDAgEBA4wAAV4BBgEFAc8BegG+AYEB/wGBAcEBgwH/AWQBqgFt
            Af8BUAGZAVgB/wFKAZEBUgH/AUQBiAFLAf8BPgGBAUQB/wE4AYEBPgH/ATMBeQE4Af8BLgFyATIB/wEq
            AWwBLQH/ASYBZwEpAf8IAAEeAgEBKQFeAgcB1wF0Ai0B7wF5Ai0B7QOuAf8DlwH/A3oB/wOBAf8DlwH/
            A64B/wF5Ai0B7QF0Ai0B7wFeAgcB1wEeAgEBKYgAAV0BBAEDAcQBgQHIAYYB/wGcAdUBpQH/AZgB0wGh
            Af8BlAHQAZ0B/wGQAc4BmAH/AYsBywGTAf8BhwHJAY4B/wGCAcYBiQH/AYEBwwGEAf8BgQHBAYEB/wF/
            Ab4BgQH/AXsBvQGBAf8BKgFsAS0B/wgAAT8CAQFpAWgCJAHvAUMCAQF0AVoCAgG5AU4COAH6A08B/wNa
            Af8DWgH/A08B/wFOAjgB+gFaAgIBuQFDAgEBdAFoAiQB7wE/AgEBaYgAAWABBQEEAckBgQHMAYoB/wGi
            AdgBqwH/AZ4B1gGnAf8BmgHUAaMB/wGWAdIBnwH/AZMBzwGaAf8BjgHMAZUB/wGJAcoBkAH/AYUBxwGL
            Af8BgQHFAYcB/wGBAcIBggH/AYEBwAGBAf8BLgFyATIB/wgAAUsCAgGKAXgCSwH3AT4CAQFnAQkCAQEK
            AVYCHQHzA70B/wPOAf8DwgH/A60B/wFWAh0B8wEJAgEBCgE+AgEBZwF4AksB9wFLAgIBiowAAWEBBwEG
            AdEBgQHNAYsB/wGBAckBhwH/AWYBuAFxAf8BYQGxAWsB/wFcAakBZQH/AVYBoQFfAf8BUAGZAVgB/wFK
            AZEBUgH/AUQBiAFLAf8BPgGBAUQB/wE4AYEBPgH/ATMBeQE4Af8IAAEyAgEBTgFuAikB8AGHAkAB7gFY
            AgIBtgFMAjoB/ANuAf8DkgH/A4EB/wNuAf8BTAI6AfwBWAICAbYBawITAeEBbgIpAfABMgIBAU6QAAFm
            AQ4BCgHbAm4BQwH3MAABBgIBAQYBSwICAYoDkQH/A+gB/wPdAf8DwQH/AWYCDQHeAV0CAwHCAawChAH4
            A90B/wPEAf8DkQH/AUsCAgGKAQYCAQEGkAABBgIBAQYBWwICAbs0AAEKAgEBCwFDAgEBdQFwAicB7gOe
            Af8BagIQAeEBJgIBATcBEwIBARgBZQILAd0DngH/AXACJwHuAUMCAQF1AQoCAQEL/wD/AP8A/wCQAAE/
            AgEBawFaAgIBvAF+AR4BEgHtAZkBPgEkAfcBmQE+ASQB9wGZAT4BJAH3AZkBPgEkAfcBmQE+ASQB9wGZ
            AT4BIwH3AZkBPgEjAfcBmQE9ASMB9wGBASIBEwHvAV0CAgG9ATwCAQFjIAABAgMBATwCAQFkAYABNwEs
            AfQBsgGBAV8B/wGvAYEBWwH/AYIBPwEuAfYBQwIBAXNgAAE8AgEBYwFbAgIBvwFbAgIBvwE8AgEBYxwA
            AWkBCwEIAd4BoAFfAVgB8gHdAcQBvAH9AfYB6wHeAf8B9gHqAd4B/wH2AeoB3AH/AfYB6gHcAf8B+gHz
            AesB/wH6AfMB6wH/AfoB8gHqAf8B/AH3AfMB/wHiAc4BywH9AZYCVwHwAWUBBgEDAdUcAAEqAgEBPQFw
            ARcBEQHnAbIBgQFhAf8BywGrAYkB/wHRAbQBlQH/AbsBjgFsAf8BtQGHAWMB/wGrAYABVgH/AXUBHAEX
            AesBLgIBAUYYAAEuAgEBRgFcAgIBvgFdAgMBxAEyAgEBTSQAAR4CAQEpAQwCAQEOAQMCAQECAWsCHQHq
            A70B/wOyAf8BXQIXAeoBAwIBAQIBDAIBAQ4BHgIBASkQAAGQATkBIAH1AeQB0QHFAf4B/QG/AXEB/wH8
            Ab0BcAH/AfsBvgFuAf8B/AG+AW0B/wH8Ab4BbQH/AfwBvQFrAf8B+wG9AWwB/wH7AbwBagH/AfwBvgFp
            Af8B/AG8AWsB/wHjAdABzgH9AYoBLQEZAfMUAAEQAgEBFAEHAgEBCAGlAX8BVgH+AdUBuwGfAf8B1gG7
            AZ4B/wHTAbgBnAH/AdEBswGUAf8BtwGJAWYB/wG6AY4BawH/AbgBjQFqAf8BsgGBAV8B/wGgAXUBTQH+
            EAABHwIBASsBVAICAaUBkgKJAf4DzQH/A70B/wOhAf8BVwICAawBIwIBATEYAAFSAgIBmwFwAl4B/QFl
            AhQB5wEUAgEBGQFrAhcB5wPLAf8DxwH/AWUCFAHnARQCAQEZAWUCEAHnAU8CPwH9AVECAgGbDAABnQFF
            AScC9wHtAeMB/wH9AcIBdwL/AdgBoAL/AdcBngL/AdYBmwL/AdcBmAL/AdYBlgL/AdYBlQL/AdUBlAL/
            AdQBkwH/AfsBvgFuAf8B+wH3AfQB/wGZAT4BJAH3CAABAgMBATwCAQFjAWkBRgExAfQBbAGiAXMB/wFq
            AaEBcgH/AbEBgQFbAf8B4QHNAbgB/wHYAcABpQH/AdgBwAGnAf8B1AG6AZ0B/wG4AYwBaQH/AbcBigFp
            Af8BuAGNAWoB/wG6AY4BawH/AbEBgQFbAf8IAAESAgEBFgFKAgIBhQF3AjIB7wPFAf8D6wH/A+gB/wPM
            Af8DzQH/A7MB/wF8AkAB8wFLAgIBjQEVAgEBGwwAAUYCAQF7A7wB/wPeAf8DpgH/AXcCPQH0AYACfwH+
            A8QB/wPCAf8BdgJtAf4BaQI0AfQDpgH/A9IB/wOBAf8BRgIBAXsIAAGfAUcBKAL3AfAB5gH/AfgBtAFe
            Af8B9wG0AV8B/wH3AbUBXQH/AfgBtAFcAf8B+AGyAVwB/wH3AbMBWwH/AfcBswFbAf8B9wGyAVoB/wH3
            AbIBWAH/AfcBsgFYAf8B/AH5AfUB/wGdAUIBJgH3BAABKgIBAT0BZQEcARQB5wFvAaMBdQH/AZMBwAGZ
            Af8BngHHAaQB/wF6AawBgQH/Aa8BgQFaAf8B4wHQAbwB/wHaAcMBqwH/AdMBuAGeAf8BxwGjAYEB/wHB
            AZgBeAH/AbYBiQFlAf8BtwGKAWkB/wG6AY4BawH/AbEBgQFdAf8BBgIBAQYBPQIBAWUBZgINAdsDwQH/
            A+gB/wPrAf8D3gH/A9YB/wO7Af8DuwH/A8sB/wPHAf8DqwH/AWsCEQHgAUACAQFtAQkCAQEKBAABRwIB
            AX0BngKVAf4D1QH/A8UB/wPLAf8D0QH/A8kB/wPHAf8DzAH/A8UB/wO9Af8DywH/AXcCbgH+AUcCAQF9
            CAABoAFIASkB9wH4AfEB6AH/Af4B5QHVAf8B/QHlAdMB/wH9AeUB0wH/AfwB5QHTAf8B/AHlAdMB/wH8
            AeQB0QH/AfwB4gHOAf8B/AHiAcwB/wH7AeAByQH/AfsB4QHIAf8B/QH6AfcB/wGdAUUBJwH3BAABbAGO
            AWsB/gGpAc0BrwH/AaYBzAGsAf8BogHJAakB/wGZAcUBnwH/AXQBqQF9Af8BrgGBAVgB/wHcAcgBsAH/
            Ab8BnwGBAf8BuAGNAW4B/wHRAbMBjwH/AdEBswGPAf8BuwGQAW8B/wG8AZEBcQH/AbcBigFpAf8BsQGB
            AVsB/wFbAgIBuwO+Af8D4wH/A/EB/wPnAf8D3QH/A9oB/wPWAf8DvgH/A8EB/wPBAf8DuwH/A8sB/wPA
            Af8DpgH/AVwCAwHBCAABSgICAYUDxQH/A8EB/wPFAf8DxwH/A6oB/wOnAf8DwQH/A74B/wO1Af8DqgH/
            AUoCAgGFDAABoAFLASoB9wH4AfIB6wH/Af4B5wHWAf8B/QHnAdYB/wH9AecB1gH/Af0B5wHWAf8B/QHm
            AdUB/wH9AeUB0wH/AfwB5AHRAf8B/AHiAc0B/wH7AeEBywH/AfsB4QHJAf8B+wH3AfIB/wGgAUcBKAH3
            BAABawGhAXIB/wHAAdoBxQH/Aa0B0AGzAf8BqwHOAbEB/wGeAcgBpgH/AXYBqgF/Af8BlQKBAf8BYwFq
            AcgB/wFZAWEB4wH/AVgBXwHgAf8BYQFoAcgB/wGQAYEBhAH/AbsBkAFvAf8B0QGzAY8B/wHGAaIBgQH/
            AaEBeAFPAf4BkQJsAfkD9QH/A/IB/wPnAf8D5AH/A98B/wPbAf8D1gH/A8AB/wPCAf8DwgH/A8IB/wO9
            Af8DvgH/A8kB/wGCAloB+AFgAgUBzQFoAhQB4wF5AjAB7gPPAf8DxgH/A8wB/wFfAgQBxgEtAgEBRAEt
            AgEBRAFfAgMBxgPBAf8DvAH/A7kB/wFkAh8B7gFhAg0B4wFbAgMBzQQAAaABSwEqAfcB+QHzAewB/wH+
            AegB1gH/Af4B6AHXAf8B/QHnAdYB/wH9AecB1gH/Af0B5wHVAf8B/QHlAdMB/wH7AeQB0AH/AfsB4wHM
            Af8B+gHfAccB/wH6Ad8BxgH/AfoB8gHqAf8BoAFIASkB9wQAAWkBoAFxAf8BxQHeAckB/wG0AdQBuQH/
            AaQByQGqAf8BgQGrAZoB/wFqAXYBwwH/AVkBYQHgAf8BbwFxAesB/wKTAfQB/wFqAWwB6gH/AWEBZAHk
            Af8BUgFbAdwB/wFpAWwBvgH/AaYBiQGBAf8BwQGaAXoB/wFgAQQBAwHIAXwCOQHwA/MB/wPwAf8D7AH/
            A+oB/wPkAf8D2gH/A9gB/wPEAf8DuwH/A74B/wPCAf8DwwH/A8AB/wPLAf8BdwI2AfABvwKtAf0D4gH/
            A9IB/wPGAf8DzQH/A7EB/wEtAgEBRAgAAS0CAQFEA6gB/wPCAf8DtwH/A8AB/wPSAf8BYgJQAf0EAAGg
            AUwBKwH3AfkB9AHtAf8B/gHoAdgB/wH+AegB2AH/Af4B6AHXAf8B/gHnAdYB/wH9AeUB0wH/AfwB5AHR
            Af8B+wHhAcwB/wH6AeABxwH/AfkB3QHDAf8B+AHcAcIB/wH6AfQB7QH/AaABSwEqAfcEAAFmAZ8BbgH/
            AbkB1gG+Af8BhwG6AY8B/wF6AawBgQH/AVwBYgHcAf8BbwFzAesB/wGYAZYB9AH/ApEB8wH/AYkBigHw
            Af8BZAFoAecB/wFoAWsB6QH/AWYBagHoAf8BWgFhAeQB/wFSAVQBvwH+AS0CAQFDAQkCAQEKAXwCOgHw
            A/MB/wPxAf8D7gH/A+EB/wPHAf8DywH/A9EB/wPRAf8DzAH/A7EB/wO7Af8DwAH/A8AB/wPOAf8BdwI2
            AfABvwKvAf0D6QH/A9YB/wPJAf8DzgH/A6UB/wEtAgEBRAgAAS0CAQFEA6wB/wPEAf8DugH/A8YB/wPd
            Af8BbAJaAf0EAAGgAUwBKwH3AfkB9AHvAf8B/gHnAdcB/wH9AecB1gH/Af0B5wHVAf8B/QHmAdQB/wH8
            AeYB0gH/AfsB4QHMAf8B+gHfAccB/wH4AdwBwgH/AfYB2gG9Af8B9gHYAbsB/wH6AfQB7wH/AaABSwEq
            AfcEAAFtAY8BawH+AYYBugGPAf8BmQHGAaIB/wF9Aa0BgQH/AVgBYAHiAf8BtAGxAfkB/wGXAZYB9AH/
            ApMB9AH/AYwBjQHwAf8BZQFpAegB/wFlAWoB5wH/AWYBagHoAf8BaAFrAekB/wFYAWAB4gH/ASICAQEw
            BAABfAI7AfAD8wH/A+kB/wPdAf8D3gH/A8IB/wPaAf8D/QH/A/0B/wPaAf8DwwH/A9cB/wO7Af8DuwH/
            A88B/wF3AjYB8AFhAgYBzQFvAhoB4wF/AjkB7gPYAf8DzQH/A7wB/wFfAgMBxgEtAgEBRAEtAgEBRAFf
            AgMBxgPDAf8DwgH/A80B/wFxAisB7gFoAhMB4wFfAgUBzQQAAaABTQEsAfcB+QH0AfAB/wH8AeYB0wH/
            AfwB5gHUAf8B/QHnAdMB/wH8AeQB0QH/AfsB4wHNAf8B+gHgAcgB/wH4AdwBwgH/AfUB1gG7Af8B8wHU
            AbUB/wHxAdIBswH/AfgB9AHwAf8BnwFLASoB9wQAAWACBAHIAYEBtAGFAf8BfwGvAYEB/wF4AasBgQH/
            AVcBXQHhAf8BtAGxAfkB/wGVAZYB9QH/AW8BcwHrAf8BeAF6AewB/wF3AXsB7AH/AWMBZQHlAf8BZQFq
            AecB/wFoAWsB6QH/AVoBYQHiAf8BIgIBATAEAAGaAoMB+wPYAf8DzQH/A84B/wPRAf8DrBH/A6wB/wPR
            Af8DzAH/A8EB/wO+Af8BkgJ3AfsIAAFKAgIBhQPUAf8DzAH/A8kB/wO6Af8DnAH/A6EB/wPCAf8DxgH/
            A8EB/wO3Af8BSgICAYUMAAGgAU0BLAH3AfkB9QHxAf8B/AHjAc8B/wH7AeQB0AH/AfwB5AHPAf8B/AHj
            Ac0B/wH6AeEBygH/AfkB3QHEAf8B9gHZAbwB/wH0AekB3wH/AfcB8gHsAf8B+wH3AfMB/wH1Ae8B6QH/
            AaQBXQE5AfsEAAEJAgEBCgEoAgEBOwE4AgEBWwF3AagBgAH/AVUBWwHgAf8CogH0Af8BcwF1AewB/wFq
            AWwB6gH/AZcBkwH3Af8BlwGTAfcB/wFtAXEB6QH/AW4BbwHqAf8BZQFqAecB/wFYAWAB4gH/ASICAQEw
            BAABUgICAZ8DrgH/A9UB/wP9Af8D/QH/A8cB/wO1Af8DowH/A6MB/wO1Af8DxwH/A/wB/wP7Af8D0gH/
            A64B/wFVAgIBpgQAAUcCAQF9AboCsgH+A9wB/wPUAf8D2QH/A9sB/wPWAf8D1AH/A9kB/wPSAf8DywH/
            A8gB/wGAAnkB/gFHAgEBfQgAAZYBSQEqAfYB+QH1AfEB/wH8AeMBzQH/AfsB4wHOAf8B+wHjAc0B/wH7
            AeIBywH/AfkB4AHIAf8B+AHcAcIB/wH1AdYBugH/Af0B+wH4Af8B/AHmAc0B/wH6AeUByQH/AeIBtgGE
            Af8BVQICAaYUAAFdAVoBwQH+AoEB8gH/AZcBkwH3Af8BbQFxAekB/wFbAWEB4wH/AVsBYQHjAf8BbQFx
            AekB/wGXAZMB9wH/AoEB8gH/AlYBwAH+ARwCAQEmCAABlAJpAfgM/wPgAf8DrAH/A9EB/wPRAf8DqwH/
            A+AN/wGUAmkB+AgAAUYCAQF7A9wB/wPtAf8D2wH/AZECWQH0AbYCrQH+A9YB/wPUAf8BqAKfAf4BhgJP
            AfQDywH/A+cB/wO3Af8BRgIBAXsIAAF4ASABEgHqAdIBxAHCAfwB+gHgAccB/wH7AeEByQH/AfsB4gHJ
            Af8B+wHgAcgB/wH5Ad8BxQH/AfgB2wHBAf8B9AHWAbgC/wH7AfgB/wH2AdgBtAH/AeEBsAGBAf8BoQFO
            ATkB9gEHAgEBBxQAAWABAwEFAcgBdwF4AewB/wFvAXEB6wH/AWgBawHpAf8CgQHwAf8CfQHwAf8BaAFr
            AekB/wFyAXQB6wH/AXgBegHsAf8BYAEDAQUByAwAAUoCAgGGAWkCEgHfAaICkAH9A6IB/wOxAf8D1gH/
            A/0B/wP8Af8D0wH/A7EB/wOiAf8BogKQAf0BaQISAd8BSgICAYYMAAFSAgIBmwG/ArUB/QF2AiIB5wEU
            AgEBGQF1AiIB5wPeAf8D3QH/AXMCIAHnARQCAQEZAXMCIAHnAacClQH9AVICAgGbDAABXwIDAcMBigFA
            AT4B7AHSAcQBwAH8AfgB9AHtAf8B+AHzAe0B/wH4AfMB7QH/AfgB8wHtAf8B+AHyAewB/wH3AfIB7AH/
            AfIB5gHXAf8B4gGyAYEB/wGdAUoBNQH1AQcCAQEHGAABCQIBAQoBKAIBATsBOAIBAVsBagFsAeMB/wFa
            AWAB4gH/AVoBYAHiAf8BaAFrAeMB/wE6AgEBXgEoAgEBOwEJAgEBChgAARICAQEWAZYCdwH6EP8BlgJ3
            AfoBFAIBARocAAEeAgEBKQEMAgEBDgEDAgEBAgF6AioB6gPlAf8D5AH/AXMCJwHqAQMCAQECAQwCAQEO
            AR4CAQEpEAABOwIBAWABWwICAbsBggErARoB7gGWAUsBKwH2AaIBUAEuAfcBogFQAS4B9wGiAVABLgH3
            AaIBUAEuAfcBoQFQAS4B9wFmAQcBBgHUAU0CAgGRAQYCAQEGYAABSgICAYYBbQIcAeQBmgKRAf4BmgKR
            Af4BbQIcAeQBSgICAYYsAAE8AgEBYwFdAgMBvwFdAgMBvwE8AgEBYxgAAUIBTQE+BwABPgMAASgDAAFA
            AwABIAMAAQEBAAEBBgABARYAA/8BAAT/BAAE/wQABP8EAAT/BAAB5wP/BAAB4wH/AYABAQQAAcABAQGA
            AQEEAAGAAQEBgAEBBAABgAEBAYABAQQAAcABAQGAAQEEAAHnAf8BgAEBBAAB5wH/AcABAwQABP8EAAT/
            BAAE/wQABP8EAAGAAQEB/gEDAv8B/AE/AYABAQH8AQAB/AE/AeABBwGAAQEB8AEAAfABDwHAAQMBgAEB
            AYABAAHAAQMBgAEBAYABAQQAAYABAQGAAQEEAAHAAQMBgAEBBgABgAEBBAABAQKAAQEEAAEBAoABAQEA
            AQEEAAGAAQEBAAEBAgABwAEDAYABAQEAAQECAAGAAQEBgAEBAfABAQGAAQEBgAEBAYABAQHwAQMBgAEB
            AcABAwGAAQMB8AEDAfABDwHgAQcBgAEHAv8B+AEfAfwBPws=
    </value>
      </data>

    Friday, July 14, 2006 8:03 AM
  • Hi!

    Its a BUG in visual studio.

    To workaround this BUG, You try two ways

    1) click with right button over project and select CLEAN option.

    Now try ReBuild and RUN.

    Its work to me.

    2) put one treeview in your app and associate imagelist to this treeview, and change thie treeview to VISIBLE = false. Them use number 1 procedure... (its sad)

    I hope this help!

    • Proposed as answer by FarzanCool Wednesday, March 17, 2010 7:03 AM
    Monday, October 2, 2006 1:16 PM
  • It is localization bug.
    It happens because when you run appplication, it reads localized resx file, which doesn't contain some images. The solution is to add this images to the localized version of resx file of the form.
    Tuesday, October 17, 2006 6:26 PM
  • Hello,

     

    I got the same error and i searched everywhere to fix that problem but i could not find any information to fix this problem. An finally i found the solution on my own. now here is the solution;

     

    The solution is adding images in to the imagelist by your own

     

    first of all add all images that you are going to use for imagelist in to your projects Resources folder. Then in to the form_load prosedure

     

    this.ımageList1.Images.Add(Your_Name_Sapce.Properties.Resources.Image1); //add this line as much as you are going to add in to your imagelist

    this.ımageList1.Images.Add(Your_Name_Sapce.Properties.Resources.Image2);

     

    for each image, add a line like below to declare the index of files.

     

    this.mageList1.Images.SetKeyName(0, "image1");

    this.mageList1.Images.SetKeyName(1, "image2");

     

    That is all

     

    Do not forget to edit Your_Name_Space, Image1 adn Image2 as your needs Smile

     

    I hope it would help you.

    Sunday, May 27, 2007 5:50 PM
  • Hi,

     

    Look into the References of your Project.

    If you have a System.Windows.Forms Version 1.x reference, remove it and add a reference to System.Windows.Forms Version 2.0.0.0.

    Seems to be problem when upgrading from Visual Studio 2003 to 2005...

     

    That worked for me.

     

    Best regards,

    Tony

    Friday, January 11, 2008 10:18 AM
  • Hi,

     

    I have this same issue.

     

    PS.

    My IDE version is VS.NET 2008,

    and my  Standards and formats  in the Reginal and language options  is German (Swittzerland)

     

     

    ....................................................................................................

    It's stupid VS.NET Bug ...!!!!

     

    I try to fix this error ...edit..and..edit...and...try...and...

     

    but my project still can not run!!...it's still error "Index was outside the bounds of the array (Imagelist - SetKeyName)"

    ....................................................................................................

     

    my way to solve this error...I changes my Standard and formats to "English (United States)".

     

     

     

     

    Friday, August 8, 2008 5:00 AM
  • Hi all

    I have the same problem.

    I am workin on a software developped in 2005, so it s either VS2003 or VS2005 (language C#). I upgraded it to 2008.

                It is always the same exception on the main form where I am using the imagelists. One of them has 13 images, but it keeps reading only 11.

    I get the following exception on the designer generated code.

     

     

    System.IndexOutOfRangeException was unhandled

      Message="Index was outside the bounds of the array."

      Source="System.Windows.Forms"

      StackTrace:

           at System.Windows.Forms.ImageList.ImageCollection.SetKeyName(Int32 index, String name)

           at EmisBuilder.Form1.InitializeComponent() in C:\Documents and Settings\s_kaouk\My Documents\Emis\26-3-2009\EmisBuilder2.0.1\Form1.cs:line 1601

           at EmisBuilder.Form1..ctor() in C:\Documents and Settings\s_kaouk\My Documents\Emis\26-3-2009\EmisBuilder2.0.1\Form1.cs:line 433

           at EmisBuilder.Form1.Main() in C:\Documents and Settings\s_kaouk\My Documents\Emis\26-3-2009\EmisBuilder2.0.1\Form1.cs:line 3651

           at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)

           at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)

           at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()

           at System.Threading.ThreadHelper.ThreadStart_Context(Object state)

           at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)

           at System.Threading.ThreadHelper.ThreadStart()

      InnerException:

     

     

     

    It gives the exception on the setkey(11,"")

    // imActions

                //

                this.imActions.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imActions.ImageStream")));

                this.imActions.TransparentColor = System.Drawing.Color.Transparent;

                this.imActions.Images.SetKeyName(0, "");

                this.imActions.Images.SetKeyName(1, "");

                this.imActions.Images.SetKeyName(2, "");

                this.imActions.Images.SetKeyName(3, "");

                this.imActions.Images.SetKeyName(4, "");

                this.imActions.Images.SetKeyName(5, "");

                this.imActions.Images.SetKeyName(6, "");

                this.imActions.Images.SetKeyName(7, "");

                this.imActions.Images.SetKeyName(8, "");

                this.imActions.Images.SetKeyName(9, "");

                this.imActions.Images.SetKeyName(10, "");

                this.imActions.Images.SetKeyName(11, "");

                this.imActions.Images.SetKeyName(12, "");


    I have added   int toto=this.imActions.Images.Count; it gives me the value 11 and not 13.

    I also tried to remove the existed reference System.Windows.Forms with the one of version 2.0.0.0 but it didn’t work as well


    Please help



    Friday, March 27, 2009 11:38 AM
  • My friend Kelvin told me:

    I also meet the same problem, but I soloved it just now.

    Firstly, it's a Visual Studio C#'s bug. The releation between Form.cs and Form.resx was disturbed. I found a easy way to fix it:

    1. Change the Form.cs to another name, press 'F5', you can run.
    2. Change the name back, press 'F5' again, it fixed.

    The reason is when you change the form name, VSS re-associated the resx file automaticlly.
    Saturday, April 11, 2009 1:57 PM
  • Hello all,

    When your Form is set to Localizable=true it could be the problem like Synapse has already written.

    If you have no language specific images, the best way is to delete the complete ImageStream from these localized Resource Files (the pictures of Default language will be taken).

    On my side I added in an user specific language a picture and afterwards in the default language two pictures at that time the catastrophe begun... :-)

    best regards,
    Peter
    Friday, October 2, 2009 6:56 AM
  • Yes I had the same problem
    VS 2005, new localized application with ImageList and TreeView.
    When I added a new image I started to get an exception.

    I confirm that the best solution is to simply edit all of the localized versions of the resource file and delete the imagestream.
    Leave only the default resource file.
    • Proposed as answer by RedGlow Wednesday, August 31, 2011 8:36 AM
    Wednesday, February 17, 2010 10:33 AM
  • Confirm the problem is still here with VS2010, even thought the project was a 2005 converted one, and the image was added in VS2010.
    Wednesday, August 31, 2011 8:37 AM
  • I realise that this is an old thread but I just wanted to confirm that I have experienced this same issue in VS2013.

    I have a form with images on it. When I use my UK culture it works fine. When I use a US culture I get the exceptions. I assume that this is due to the very same imagelist issue that everybody has been reporting.

    Friday, August 14, 2015 11:16 AM