Reference to ParentForm

bomstrong

New member
Joined
Jun 5, 2005
Messages
2
Programming Experience
5-10
Hi!

I'm developing a MDI Application called "Main" with at MDI Container form named: "frmMain".

The MDI Childs is referenced and imported as independent projects (.DLLs) because the application is build up by several modules.
The modules consists of forms - reports - classes and so on.

In project "Main"
[add reference] --> "User.dll"
and further in Class frmMain: "Imports User"

To use the login form from frmMain I do:

Dim frm as new User.frmLogIn
With frm
.Name = "Login"
.MdiParent = Me
.Show()
End with

This works fine BUT here comes the headache...

Now I want to post users information back to frmMain's statusbar

But I can't figure out to reference back to frmMains public method:

Public Sub ShowUser(ByVal User as string)
Me.Statusbar1.Text = User
End Sub

It is clear to me that from the User module there is a Me.ParentForm reference but I still can't
cast this particullar reference AS A "frmMain" object.

The "Main" module is a .exe file and therefore I can't make a reference to it (And if I could it would sure give some circular reference problems!)

Is there a way around this!

I would be happy for an answar to this - thanks in advance!

Bomstrong
 
Let's short cut it, please. Don't tell me about vb.NET (theory) but rather simply tell me what you exactly need there in couple words. Am i right if i rephrase your question and say that you need only to pass some text from MdiChild form to its parent moreover to the status bar located inside MdiParent?

Regards ;)
 
I dunno if i understand you question but it seems that u have a childforms ( in the dll) and you are trying to pass data back to the parent form (in the .exe).
There are few possible ways to accomplish your task, but one of the ways is to create a separate dll and add a class with some shared events and/or properties.Both projects (.exe and childforms) will add a reference to that dll. So whenever one form changes the value (in your case, a childform), raise event (valueChangedEvent) and catch it on the form that u want to consume data(in your case frmMain in .exe)

Let me know if this advice makes sense to you
 
Back
Top