Yes, you should dispose of the form:
private void button1_Click(object sender, EventArgs e)
{
using (frmCustomDialog f = new frmCustomDialog())
{
if(f.ShowDialog() == DialogResult.OK)
{
TextBox1.Text = f.MyCustomProperty;
}
}
}
ShowDialog()
doesn't dispose of the form as you can reuse it and show it again. If you don't need to do this, you should just dispose it yourself.
From the docs of ShowDialog()
:
Unlike modeless forms, the Close
method is not called by the .NET
Framework when the user clicks the
close form button of a dialog box or
sets the value of the DialogResult
property. Instead the form is hidden
and can be shown again without
creating a new instance of the dialog
box. Because a form displayed as a
dialog box is not closed, you must
call the Dispose method of the form
when the form is no longer needed by
your application.