0

I am currently working in Visual Studio Community 2015, in the C# language.

I have a form( Form1), and other 5 forms inherited from it. When I want to add another inherited form from Form1, I get the following error

 "Index was outside the bounds of the array"

I tried to inherit the form this way: Project-->Add new item--->Inherited form---kaboom, the error.

Praveen Reddy
  • 7,295
  • 2
  • 21
  • 43
  • Difference from standard 'Form' and 'Inherited Form' is only the inheritance. Have you tried simply creating a new standard 'Form' and then adding inheritance properties afterward? – vipersassassin Feb 18 '17 at 15:29
  • @vipersassassin Yes, I did, but the controls on the new form appear dislocated from the original form, even though I set exactly the same characteristics for the new one. If I moved the controls on the original form, I would have to break everything I did until now – Stefan Roata Feb 18 '17 at 15:35
  • Do know that some events/code in your form will run, despite being in the designer. Could it be that your code isn't aware of that? Maybe helpful: http://stackoverflow.com/questions/73515/how-to-tell-if-net-code-is-being-run-by-visual-studio-designer – rene Feb 18 '17 at 15:37
  • @rene Thanks for the suggestion, but that's not the case. I am trying to find out why adding a new inherited form this way doesn't work anymore – Stefan Roata Feb 18 '17 at 15:42
  • You don't have a stacktrace? Only that message? – rene Feb 18 '17 at 15:44
  • @rene Yes, only that message – Stefan Roata Feb 18 '17 at 15:45
  • Looks like this is a Winforms project, right? – rene Feb 18 '17 at 15:48
  • @rene Yes, you are right – Stefan Roata Feb 18 '17 at 15:51
  • 1
    I tested this on blank forms and didn't find any issues with any number of inherited forms. If the inherited forms appear different, you may want to look at what the difference is between the first inherited form and the original to give a direction on how to do it simply. Once this is done you may find what VS was running into on this next iteration. – vipersassassin Feb 18 '17 at 15:52
  • @vipersassassin I can't do anything at the moment, as I am installing some updates for vs 2015 comm. Maybe that is the problem, not updating? – Stefan Roata Feb 18 '17 at 15:58
  • if you are updating, I wouldn't suggest working on any projects, although not updating is likely not a root cause (can't be sure of this though as I don't know what is specifically being updated). – vipersassassin Feb 18 '17 at 16:06
  • @vipersassassin It doesn't let me work on vs while it's updating – Stefan Roata Feb 18 '17 at 16:11
  • If I understand the problem description correctly, this exception is not thrown while running your code but while using Visual Studio. You may be able to apply some of the same techniques used when debugging this exception (see marked duplicate) in run-time code, to track down this issue. If after following that advice you still can't fix the issue, you need to post a new question that includes **a good [mcve] that reliably reproduces the problem**. No one here is going to be able to help you fix your problem if they don't have a way to reproduce it themselves. – Peter Duniho Feb 18 '17 at 21:53

0 Answers0