Bob,
You are using object initialization syntax. Which is causing your problems.
When you create a new Form1 a new form2 gets created, when a new form2 gets
created a new form1 gets created, which causes a new form2, which causes a
new form1, which will go on until you run out of stack space.
Change these two lines:
Dim objForm1 As New Form1()
Dim objForm2 As New Form2()
To:
Dim objForm1 As Form1
Dim objForm2 As Form2
Now the problem becomes how to initialize the variables. Normally I pass an
instance of the object to the constructor of the form (add an overloaded Sub
New). Unfortunately this will not work in this case as you have two forms
that mutually refer to each other. In that case I normally have the second
object accept the first as a parameter to the constructor, in the constuctor
of the second I call a property of the first to set the reference to the
second.
Out of curiosity: What are you attempting to do, that you have each form
refer to the other? I suspect a Singleton Pattern might be a better
approach.
Hope this helps
Jay