title: Modal Dialog Box
body: <p>I have created two forms in my Windows Application.</p>
  
  <p>One Form acts as a Form and the other form acts as a MODAL DIALOG BOX.</p>
  
  <p>The Form Dialog Box contains a button and One textBox.
  When this button is clicked the MODAL DIALOGBOX should be displayed.
  This dialog box also contains One Textbox and Two Buttons(Ok and Cancel).</p>
  
  <p>Now when this dialog box is displayed the TextBox of the dialog box should contain the value entered in the textbox of Form1.</p>
  
  <p>I have used the following coding to accomplish this task.
  Form1 Coding:</p>
  
  <pre><code>public string UserName;
  private void btnFn_Click(object sender, EventArgs e)
  {
    UserName = txtUserName.Text;
    frmFnC objFnC = new frmFnC();
    objFnC.ShowDialog();
    objFnC.txtUserName.Text = UserName;
  }
  </code></pre>
  
  <p>Code in MODAL DIALOGBOX OK button:</p>
  
  <p>Please note that the Cancel button is enabled only when the OK button is clicked.</p>
  
  <p>Coding:</p>
  
  <pre><code>private void btnOk_Click(object sender, EventArgs e)
  {
      btnCancel.Enabled=true;
  }
  private void btnCancel_Click(object sender,EventArgs e)
  {
    this.Close();
  }
  </code></pre>
  
  <p>The problem I am facing is the value entered by the User in the USERNAME textbox is not displayed in the TEXTBOX in the MODAL DIALOG BOX. Instead it is displaying the textbox as empty.</p>
  
  <p>What should I do to get the values entered by the user in the textbox to this modal dialog box?</p>
  
  <p>Can anybody help me out in performing the desired task?</p>
  
  <p>Thanks in advance!!!</p>