Unknown Form Load Error

G

Guest

When loading my project i get the following error message.

The form referred to itself during construction from a default instance,
which led to infinite recursion. Within the Form's constructor refer to the
from using "Me.".

I have a main form named frmMain. I have another form named frmProjects.
Within the form frmProjects I have a combo box event called
_EditValueChanged, which makes a call back to a Public Procedure in frmMain
called frmMain.sDisplayProjects, which display values on the frmProjects form
from the frmMain form. I am also doing a similar thing in a form named
frmGroups.

What I noticed is if I comment out the code in my _EditValueChanged event on
the frmProjects from, the error goes away. Is it illigal to have a event in
one form call a Public Procedure in another form that in turn populates
controls in the calling form?

I hope what I have said makes some sense.
 
G

Guest

It sounds like you have code in the constructor that probably should not be
there.

In the ComboBox_SelectedIndexChanged event procedure you can
Create a reference to frmMain using the modForms hashtable that I described
in my other response.

dim Fmain as form = modForms.Forms("frmMain")

You would have a friend or public function in FMain that takes one or more
parameters which indicate to the function what you need, and the function
will be written to return the data needed by your project form...as an
ArrayList, or whatever object serves your purposes.

Friend Function GetProjectData(ComboItem as String) as ArrayList
dim ProjList as new ArrayList
'Add code to get the data you need
Return ProjList
End Function

Then you can call the function from your project form, get the return value,
and handle the data from within the project form.

Don't try to manage your project form from within the main form...just get
the data you need using the function, and manage the data from within the
project form.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top