private void btnChangePort_Click(object sender, EventArgs e) { AscomGuiding.PortDialog theDialog = new AscomGuiding.PortDialog(); theDialog.Port = Int16.Parse(txtPort.Text); if (theDialog.ShowDialog() == DialogResult.OK) { String newPort = theDialog.Port.ToString(); if (newPort != txtPort.Text) { txtPort.Text = newPort; } } }