Why not just get the pointer of first dialog in second dialog?
A constructor of second dialog can take pointer of first dialog, and directly set the control's text.
Yes, the appropriate control variable should be accessible to second dialog-class.