Solved

How to exchange data between forms?

Posted on 2001-08-23
8
258 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to convert MFC::CString to UTF8 wchar_t* 10 465
How to convert Structure to vector of byte and vice versa 5 42
Need some help with mailto 16 44
COM server issue 2 29
Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
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.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

752 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