Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to exchange data between forms?

Posted on 2001-08-23
8
Medium Priority
?
275 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 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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

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.

Question has a verified solution.

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

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
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++.

715 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