Hi, I'm stuck in a way I don't know how to describe..
I have a form with buttons that link to other forms
for example:
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Me.Hide()
Form2.Show()
End Sub
Now when I click on Button1 it pops up Form2 and hides Form1 as expected
This works for all Forms except one. When I click the button for that one I get an error message:
InvalidOperationException was unhandled
An error occurred creating the form. See Exception.InnerException for details. The error is: Collection index must be in the range 1 to the size of the collection.
Usually when I get an error message I can figure out what to do with it, but this time I really don't understand how to fix it. I don't even know what collection it is trying to work with.
I was editing the code on the Sub that handles the Form.Load and also some other subs that might be linked to it. I've never before had the error message pop up on the Form.Show() before unless I had made a typo in the name of the form, so this is new to me.
I've tried disabling the Form.Load Sub altogether but that didn't fix the error, so it seems to me it's not the code there that's wrong.
I've even tried a line "Stop" right at the start of the Form.Load Sub but it doesn't even seem to get there.
I also get the same error when I try to close the Form with a button like this:
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Me.Close()
Form2.Close()
End Sub
I'm using Microsoft Visual Basic 2010 Express.