<p>My users are having an intermittent error when using a Windows Forms application built in VB.NET 3.5. Apparently when they click on the form and the form re-paints, a red 'X' will be painted over the MenuStrip control and the app will crash with the following error. </p>

<p>Has anyone seen this before? Can someone point me in the right direction? </p>

<pre><code>    System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
       Parameter name: index

   at System.Collections.ArrayList.get_Item(Int32 index)
   at System.Windows.Forms.ToolStripItemCollection.get_Item(Int32 index)
   at System.Windows.Forms.ToolStrip.OnPaint(PaintEventArgs e)
   at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer, Boolean disposeEventArgs)
   at System.Windows.Forms.Control.WmPaint(Message&amp; m)
   at System.Windows.Forms.Control.WndProc(Message&amp; m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message&amp; m)
   at System.Windows.Forms.ToolStrip.WndProc(Message&amp; m)
   at System.Windows.Forms.MenuStrip.WndProc(Message&amp; m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message&amp; m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message&amp; m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
</code></pre>

[{'answer_id': 45995, 'author': 'Craig', 'author_id': 2894, 'author_profile': 'https://Stackoverflow.com/users/2894', 'pm_score': 2, 'selected': False, 'text': '<p>I like changing the default location that new projects are saved to.  </p>\n\n<p>Tools->Options (Select Projects and Solutions tab) </p>\n\n<p>This "tab" has all sorts of goodness.  Not just the ability to change the default locations and avoid saving new projects automatically but other nice things as well.  For example:</p>\n\n<p>Track Active Item - Selects the file in the solution explorer when you change windows.</p>\n\n<p>Show Output window when build starts - Toggle to show or not.  I like it on, your mileage will vary.</p>\n'}, {'answer_id': 46275, 'author': 'Owen', 'author_id': 4790, 'author_profile': 'https://Stackoverflow.com/users/4790', 'pm_score': 1, 'selected': False, 'text': '<p>I have a tip regarding the "Track Active Item" option mentioned above, for when working with big projects. It\'s posted here:</p>\n\n<p><a href="https://stackoverflow.com/questions/31163/forcing-the-solution-explorer-to-select-the-file-in-the-editor-in-visual-studio#46193">Forcing the Solution Explorer to select the file in the editor in visual studio 2005</a></p>\n'}, {'answer_id': 46300, 'author': 'David Mohundro', 'author_id': 4570, 'author_profile': 'https://Stackoverflow.com/users/4570', 'pm_score': 3, 'selected': False, 'text': '<p>I\'m a huge fan of using msbuild to build my solutions with the /m option so that it builds using multiple cores. It can drastically decrease your build time.</p>\n\n<p>Scott Hanselman posted on how to add it to your tools list at <a href="http://www.hanselman.com/blog/HackParallelMSBuildsFromWithinTheVisualStudioIDE.aspx" rel="nofollow noreferrer"><a href="http://www.hanselman.com/blog/HackParallelMSBuildsFromWithinTheVisualStudioIDE.aspx" rel="nofollow noreferrer">http://www.hanselman.com/blog/HackParallelMSBuildsFromWithinTheVisualStudioIDE.aspx</a></a>.</p>\n\n<p>I usually just run \'msbuild /m\' from the command prompt or PowerShell, though.</p>\n\n<p>Another tip that is sometimes useful is taking advantage of the pre- and post-build events to add additional logic before or after a build. To see these, go to the Properties for a Project, click on the Compile tab, and then choose "Build Events..."</p>\n'}, {'answer_id': 54112, 'author': 'Gulzar Nazim', 'author_id': 4337, 'author_profile': 'https://Stackoverflow.com/users/4337', 'pm_score': 2, 'selected': False, 'text': '<p>I love debugging with the <a href="http://blogs.msdn.com/saraford/archive/2008/07/28/did-you-know-you-can-start-debugging-multiple-projects-268.aspx" rel="nofollow noreferrer">Multiple startup projects option</a></p>\n'}, {'answer_id': 156311, 'author': 'Mario', 'author_id': 472, 'author_profile': 'https://Stackoverflow.com/users/472', 'pm_score': 2, 'selected': False, 'text': '<p>Using the command window to quickly open files in your solution:</p>\n<ol>\n<li>Bring up the Command Window (<kbd>CTRL</kbd>-<kbd>ALT</kbd>-<kbd>A</kbd>)</li>\n<li>Type <code>open &lt;filename&gt;</code></li>\n</ol>\n<p>I create an alias for <code>open</code> by executing the following at the Command Window: <code>alias o open</code>.  Visual Studio will remember the alias from then on, so I only ever need to type <code>o &lt;filename&gt;</code>.</p>\n<p>It even searches database projects unlike some third-party plugins!</p>\n<p>Unfortunately, there is a bug in the filename completion when searching for nested files.  A simple workaround is to type the beginning of the filename, hit the <kbd>ESC</kbd> key and then type the rest of the name.  To search for login.aspx.cs, type <code>login.aspx</code>, hit <kbd>ESCP</kbd> and then type <code>.cs</code>.</p>\n'}, {'answer_id': 157179, 'author': 'Rinat Abdullin', 'author_id': 47366, 'author_profile': 'https://Stackoverflow.com/users/47366', 'pm_score': 4, 'selected': False, 'text': '<p>First rule of working with Visual Studio:</p>\n\n<ul>\n<li><strong>Install <a href="http://www.jetbrains.com/resharper/" rel="noreferrer">ReSharper</a></strong></li>\n</ul>\n'}]
['https://Stackoverflow.com/questions/45924', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4770/']