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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Accessing Objects on Different Forms

Status
Not open for further replies.

xBaseDude

MIS
Jan 31, 2002
357
0
0
US
Accessing Objects on Different Forms

Gents, to do this, do (both) forms have to be part of a FORMSET?

If not, could I see a coding example of how to access the (other) forms object?

TIA - Wayne
 
no they do not have to be part of a formset.

Pass the one form to the second as an object with this command.

Do Form 'SecondForm' with ThisForm

add a property to the second form - call it anything such as
lpCallingForm


In your secondform in the init event

Place this bit of Code...

Parameters loFirstForm
lpCallingForm = loFirstForm


Now you have access to all the property and methods of the first form within the second form.

good luck,
Paul

Dancing is easy. Now dancing on a floating raft in the middle of an October storm in the middle of the North Atlantic, that is hard.
 
Wayne

It would be as well for you to discard the use of formsets in VFP - they are basically an anachronism having been replaced largely by pageframes.

To access the PEMs, properties, events and methods of another form, you need to to create an object reference for the form with :-

PUBLIC oForm1
DO FORM Form1 NAME oForm1 LINKED

Thereafter you reference the relevant property, with

oForm1.lblLabel1.Caption = [Hello World]
FAQ184-2483 - the answer to getting answered.​
Chris [pc2]
 
Thanx for takin' the time.

I will check it out.

Regards - Wayne
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top