Solved

How to exchange data between forms?

Posted on 2001-08-23
8
263 Views
Last Modified: 2008-02-01
C++ Builder 5.0: Building MDI Application.I have first form named Form1 and there I want to input some data (long double Number1, Number2, Number(...);). Then I want to use this numbers to calculate something but on the ChildForm or on the new forms named Form2, Form3, Form(...).
How to do that? (Maybe it can be usefull to create some little aplication with comments in code, compress it with WinRAR or WinZIP and send it to me).
                      Thank You.
0
Comment
Question by:Peca
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 6

Expert Comment

by:DrDelphi
ID: 6419631
Why don't you just make the data Public? This way,any other form (or unit) would be able to read it.

0
 
LVL 6

Expert Comment

by:Triskelion
ID: 6419944
How much data?
Can you make global variables?




global variables
0
 
LVL 14

Accepted Solution

by:
AlexVirochovsky earned 50 total points
ID: 6420900
I assume you are using an MDI parent as your main window. If this is true, use

Application->MainForm to access the MDI parent window.

to access this parent. The parent window can either know about each of the
shared data classes, or, you could iterate throught the ->MDIChildren[ ] to
find the form you are interested in.

Other ways:
a) Send messages with the data.
 Uses either Windows messages, Delphi messages or some more complex
messaging like DDE to pass data. Windows messages are sent with the
Windows API SendMessage and can include something like a pointer to more
complex data or simple 32 bit numeric data. Delphi messages are send the
same way, but have a different set of codes. DDE is a technology of its
own, and BCB provides components to work with it, but you'll have to
look them up.

b) Set up a shared proxy object containing the shared data.I recommend using a data module. The
data module does not need to contain any components - you just add
public properties backed with private variables, like:

private:

double FSharedFloat;

public:

__property double SharedFloat = {read=FSharedFloat,
write=FSharedFloat};

Obviously you could also expose the variable directly.

0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 11

Expert Comment

by:griessh
ID: 6861940
I think you forgot this question. I will ask Community Support to close it unless you finalize it within 7 days. Unless there is objection or further activity,  I will suggest to accept "AlexVirchovski" comment(s) as an answer.

If you think your question was not answered at all, you can post a request in Community support (please include this link) to refund your points.
The link to the Community Support area is: http://www.experts-exchange.com/commspt

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
======
Werner
0
 

Author Comment

by:Peca
ID: 6863127
I resolve the problem.
0
 

Author Comment

by:Peca
ID: 6863129
I resolve the problem.
0
 
LVL 5

Expert Comment

by:Netminder
ID: 6884088
Peca,

If you will please post what you did to resolve the problem, I will refund your points to you and close this question.

Thanks,

Netminder
CS Moderator
0
 
LVL 5

Expert Comment

by:Netminder
ID: 6899770
User declined to explain how he resolved the issue. Force-accepted by
Netminder
CS Moderator
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

627 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question