Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Accessing public variable of the owner form 1

Status
Not open for further replies.

erixire

Technical User
Jun 4, 2002
72
CA
Hi,

I call a new form within my main form like this:

dim toto as new myNewForm
toto.ShowDialog(Me)

From this new form, I want to access public information from the owner (the main form). I can I do that? I tried something like this in the myNewForm without success:

msgbox (Me.Owner.mainFormPublicVariable)

Can somebody help me?
 
Thanks chmohan, but I still have my problem: how do I access the variables from the main form within my new form? Even with your example, I wasn`t able to reach a public variable of the main form. I tried this in my new form:
Me.Owner.???.myPublicVariable

I don`t know what to put in place of the ??? to reach it. Can somebody help me with this one?

Thanks.
 
public function sendvariable() as string

sendvariable=yourvariable
end function

call this from ur child form
 
How do you call it? I tried a lot of things, but I cannot see in the member list the function "sendvariable". For example:

'My Main Form
Public Class frmMain
...
'Display the child form
Dim childForm As New frmChild()
Me.AddOwnedForm(childForm)
childForm.Show()
...
public function sendvariable() as string

sendvariable = myVariable

End Function
...
End Class


<<<...the next code in another form...>>>


'My Child Form
Public Class frmChild
...
'HOW DO I REACH THE MYVARIABLE WITH sendvariable?
...
End Class
 

Public Class frmChild
...
'HOW DO I REACH THE MYVARIABLE WITH sendvariable?
...
myvariable =Me.Owner.sendvariable
End Class



 
The
myvariable =Me.Owner.sendvariable
doesn't work for me. I don't know why. But your link above gave me the answer I wanted. So thanks a lot.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top