void ConfigOptionToolStripMenuItemClick(object sender, EventArgs e) { ConfigOptionForm optionForm = new ConfigOptionForm(); optionForm.Port = one.Port.ToString(); if (optionForm.ShowDialog(this) == DialogResult.OK) { int port = 0; if (int.TryParse(optionForm.Port, out port)) { if (port > 1024) { one.Port = port; } else { MessageBox.Show("Port number is must great than 1204"); } } else { MessageBox.Show("Port number is not valid."); } } }