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

data from parent form 1

Status
Not open for further replies.

BlueGhost79

Programmer
Feb 6, 2008
11
US
Hi,
How do I access data in a parent form from the child form?
For example how do I call a public get() function in the Parent form from the child?
 
I can think of a couple of ways. First, when you call the child form from the parent, you can send the data in the calling function. For example, here is snippet of code from one of my programs that call the child form and sends some data to it from the function call.
Code:
        // Create and destroy new form
        try
        {
            EndProdLogForm = new TEndProdLogForm(ParcelStr, ProdLogStr, PartStr, TallyInt, ClippingLine, CLiMerPath, LocalLogPath, &LocalLogEnabled, NetLogPath, &NetLogEnabled, TallyDevice, &TallyEnabled, StickerDevice, &StickerEnabled, ShiftInt, UserDate, UserStr, MaxLineCnt, ADOEnabled, CloseLogOK, CompanyNo, &LogEndedOK, DefaultReclipBool, UnclipDevice, UnclipEnabled, DefaultUnclipStockInt, this);
            EndProdLogForm->ShowModal();
        }
        __finally
        {
            delete EndProdLogForm;
            EndProdLogForm = 0;
        }

Another way is to have the child form access the parent form directly. For example, here is a snippet that access a form with a data base set. The child form calls the parent form and the data base
Code:
        TDateTime EndDate = CLiMerDataModule->ParcelffTable->FieldByName("EndDate")->AsDateTime;





James P. Cottingham
-----------------------------------------
[sup]I'm number 1,229!
I'm number 1,229![/sup]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top