Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to exchange data between forms?

Posted on 2001-08-23
8
Medium Priority
?
279 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
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 200 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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

What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
Suggested Courses

782 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