Thank you for your reply. This is very informative. Now to explain a little
more what I am doing:
I have one parent MDI form and one child form. I am using the Parent MDI
form to take advantage of the scroll bars because the user of my app has a
resolution that really restricts screen realestate - thus the scroll bars (I
have several pannels and splitters, ... on the child form - did not want to
bother with scrollbars). The child form gets data from our sql server. Each
menu button on the parent form passes a param to the child form to pick up
different rows from sql server. With each menu button on the Parent mdi, I
close the child form and re-open it as new. From what you are suggesting, I
get the idea that I do not need to keep reloading the child form. I would
rather load the child form once and pass the parameter to it from the parent
through the menubutton - but I have to reload the data.
I tried using a public sub - which I was able to reload the data by invoking
it from the parent, but the datagrids on the child did not refresh/update.
The only way I was able to get the datagrids on the child to refresh/update
was to close child and reopen child with the new parameter. Is there a way
I could open the child form once and reload/refresh the data from the Parent
Mdi form without having to reopen the child form?
Thanks,
Rich
"Graham Charles" wrote:
The error you're getting means that you're referring to a class, not an
object. In your message, you mention that the error comes on this line:
frmChild.MdiParent = Me
But then in your quoted code, you use
Dim frm As New frmChild
frm.MdiParent = Me
Note the difference: frm is an instance, frmChild is a class. So the
first snippet doesn't make sense: "frmChild" is a class, not an
instance of a class. I'm unclear about what you mean about adding an
argument to the constructor... do you mean that you pass a form
reference to the child form and have it set its own MdiParent property?
You could do that, sure; in the overloaded New() sub, pass a reference
to the parent as a parameter and then set
Me.MdiParent = theParameter
It's worth noting that in VB6, frmChild referred both to the form
"class" *and* to a default instance of the form; a lot of transitioning
coders run into this problem.
Hope that helps.
g.