Accessing Forms

G

Guest

If I have a parent form (form1) and 2 child forms (Form2 and Form3).
How can I excecute a function that located on Form3 from Form2 ?

I'm using this commands to load the child forms: (VB.NET 2003)
Private WithEvents frm2 as Form = New Form2
Private WithEvents frm3 as Form = New Form3

frm2.MdiParent = Me
frm2.Show
frm3.MdiParent = Me
frm3.Show
 
H

Herfried K. Wagner [MVP]

Alex Levi said:
If I have a parent form (form1) and 2 child forms (Form2 and Form3).
How can I excecute a function that located on Form3 from Form2 ?

I'm using this commands to load the child forms: (VB.NET 2003)
Private WithEvents frm2 as Form = New Form2

'...As New Form2'.

Calling a function:

\\\
frm2.Foo()
///
 
G

Guest

I still can't access this function because frm2 and frm3 located and declared
in Form1 and and I'm tring to call a function that located on Form3 from
Form2.
This form don't use inheretince.
 
G

Guest

thanks, but I managed to load the childs forms, and the question is if I have
a function in the Form2 (in another file):
Public aaa(byVal bbb as string)
{
///
\\\
}

how can I call to this function from Form3 (also that located in another
file).
The problem is that all of this forms are different classes and I can't make
a direct access from one class to another.
 
C

Cor Ligthert

Alex,

Did you try the sample, because in my opinion is the answer on your last
question in it. It is not a sample how to open a form, it is a sample how to
use the forms from other forms.

In a MDI situation.

I hope this helps?

Cor
 
C

Chris Dunaway

I still can't access this function because frm2 and frm3 located and declared
in Form1 and and I'm tring to call a function that located on Form3 from
Form2.
This form don't use inheretince.

In order for frm2 to access a function in frm3, it must have a reference to
frm3. You must pass a reference to frm3 into frm2 and then frm2 could
access the methods of frm3.

Perhaps a better way would be to take the function out of frm3 and put it
in a public module so that it could be accessed by all forms.

--
Chris

dunawayc[AT]sbcglobal_lunchmeat_[DOT]net

To send me an E-mail, remove the "[", "]", underscores ,lunchmeat, and
replace certain words in my E-Mail address.
 
G

Guest

The problem with the module is that I can put the function in it for all
forms, but I need a function that changes data on the form. I can call this
funciton from form3 and it will change the data in form3, but I can't call
this function from form2 so it will change the data on form3.



Chris Dunaway" <"dunawayc[[at]_lunchmeat said:
I still can't access this function because frm2 and frm3 located and declared
in Form1 and and I'm tring to call a function that located on Form3 from
Form2.
This form don't use inheretince.

In order for frm2 to access a function in frm3, it must have a reference to
frm3. You must pass a reference to frm3 into frm2 and then frm2 could
access the methods of frm3.

Perhaps a better way would be to take the function out of frm3 and put it
in a public module so that it could be accessed by all forms.

--
Chris

dunawayc[AT]sbcglobal_lunchmeat_[DOT]net

To send me an E-mail, remove the "[", "]", underscores ,lunchmeat, and
replace certain words in my E-Mail address.
 
G

Guest

I was maneged to call some default function from form3, for example: forms
text, enable, visible, exc'...

But how can I load a function that is not a default and it's not listed in
the methods list.

The parameter 'frm' can access some of the default function and my function
is not listed in the method list although it's declared as public.
The question is how can I access the function 'public sub aaa()' that
located on Form2 from Form3 ?
 

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