Referencing fields between forms

  • Thread starter Thread starter John
  • Start date Start date
J

John

Hi

How can I read the value of a field on a form A from a form B? Both forms A
& B are open.

Thanks

Regards
 
August 8, 2004

Where if form B opened and declared? You would have to use
use the instance of form A to get the underlying text. For example:

label1.text = FormAInstance.textbox1.text

or reverse

label1.text = FormBInstance.textbox1.text

If FormA is the startup form, then you will have to obtain the
instance logically. If you have multiple forms, you should place
both instances in a module:

public module something
public frmA as formA
public frmB as new formB
end module

Then to set frmA to a living instance, place this code in FormA's
Load event:

frmA = Me

This will set frmA to the living instance of FormA. Then you can
use frmA.textbox1.text to obtain the value you need!
I hope this solves your problem!


Joseph MCP
 

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

Back
Top