Click here to Skip to main content
15,848,903 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I want to create an edit control that when I write something in first edit control void CSecondDlg::EdtUserName() makes second edit control void CSecondDlg::EdtWichUser() write down the same thing automatically.

What I have tried:

I searched for tutorials on YouTube, but I didn't see a solution.
Posted
Updated 13-Sep-23 5:11am
v4

That's a little complicated, because generally speaking two instances of a control shouldn't even know that the other exists - it breaks OOPs principles if they do, unless one is the child of another (and parent-child is trivial, so I'm pretty sure you don't mean that!)

The best way to do it is have the first control post a message to it's parent, and have that post it on to the second control. That way, neither control needs to know the other exists but the parent (which created both of them and thus knows all about them) can make the decision which control to forward the text to.
 
Share this answer
 
Presumably the question again concerns an edit control in a dialog. There were already answers for this.
MFC app edit control updating itself[^]
 
Share this answer
 
Comments
Andre Oosthuizen 3-Sep-23 5:33am    
Maybe he should try AI again, seems to have worked out for him on his last post. :)
You cannot expect there to be YouTube tutorials on every question you come up with. As already suggested, you should use the documentation to check what features are available in each control that you are using: CEdit Class | Microsoft Learn[^].
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900