 <p>I think you are creating local variable of ChildBox Dialog so , even if you are assigning a value to its variable it will not work.</p> <p>Rather create a pointer variable of ChildBox Dialog</p> <p>void ParentDialog::OnInput() {</p> <pre><code>ChildBox *dlg; if (dlg-&gt;DoModal() == IDOK) { sampleCount = dlg-&gt;sampCnt; } dlg = NULL ; </code></pre> <p>}</p>