Why am I getting out of range exception with these code?
Posted on 2006-11-03
Hi: Below is the error I got from the 2 lines of code below. I don't understand why and how to correct it. The actionMenu.DropDownItems has 0 item in its collection at the time of the code. Thanks.
An unhandled exception of type 'System.ArgumentOutOfRangeException' occurred in mscorlib.dll
Additional information: Index was out of range. Must be non-negative and less than the size of the collection.
ToolStripItemCollection contextsMenuItems = contextsMenuStrip.Items;