> Are you sure that TransCount in your foreach loop has not exceeded 5 ?
> It looks like it has, which is causing the exception.
[quoted text clipped - 37 lines]
>
> - Show quoted text -
That's not the problem. when I use watch window in the debugger
TransMenuItems[TransCount] is null. I'm guessing I'm somehow not using
the array correctly because I can get it to work if I replace...
transToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[]
{TransMenuItem[TransCount]});
with...
ToolStripMenuItem TransMenuItem = new ToolStripMenuItem;
transToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[]
{TransMenuItem});
MWS - 31 Jul 2007 20:30 GMT
> > Are you sure that TransCount in your foreach loop has not exceeded 5 ?
> > It looks like it has, which is causing the exception.
[quoted text clipped - 56 lines]
>
> - Show quoted text -
I never said I was smart.
foreach (string keyname in settings.Allkeys){
TransMenuItems[TransCount] = new ToolStripMenuItem();
transToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] {
TransMenuItem[TransCount]});
TransMenuItems[TransCount].Name = "XXX";
TransMenuItems[TransCount].Text = "XXX";
TransCount++;
I was missing the declairation in my loop...