How to pass variable from one dialog box to other
Hello,
I am developing a program of multiple dailog box and, i have problem on how to pass variable from one dialog box to another.
and also i am trying to send the data over lan by TCP/IP but i do not where to put my code, as i am not able to use func send in my other dialog box's .cpp file. please help me how to proceed.
Wasim nasir
Pintu Shukla wrote: |
Assume you has Two Dialog A and B now you want to Pass data From A to B . a Simple way is create a object of B in your A now easily you can access all the member variable of B in A . Simply use your member variable of B in A Asign them value now inside B you can Thanx
| |
Not objects but pointer to other dialog class object, you will need to assign it other dialog's value before using it.
About the TCP/IP problem, can you post the code you have here ?
Hi,
I would suggest you to use an immutable class to hold the parameters you are passing from a Diablog box A to B.
You need to have pointer to B in A. And a method Accept(ParamsFromA* params) in your class B. Then you will need just to collect your parameters in class A and call instanceOfB->Accept(ParamsFromA* params).
For the question regarding TCP/IP. It's better to put the code in a Utilities package since it can be classified in a technical domain and should be independant of your application domain and workflow domain.
You can find more information about this by googling 'Layered architecture pattern'
Best regards,
Hi,
Just note that you socket has to be created in the main GUI thread (if it's an async communications)
I encountred this problem when trying to use CAsyncSocket for async communications.
Cheers,
I think you want to share data between the classes; if so why can't you go for a friend function or else why can't you create an object of that class in the other and use that variables.
Your question is giving wrong sence "How to use tcp/ip in multiple dailog box program". Once revise your application design.
Cheers,