static public string ShowDialog(IWin32Window owner, string text) { var inputBox = new FormInputBox(); inputBox.labelText.Text = text; if (inputBox.ShowDialog(owner) == DialogResult.Cancel) { return(""); } return(inputBox.textInput.Text); }
private void buttonFindRemoteComputers_Click(object sender, EventArgs e) { var ip = FormInputBox.ShowDialog(this, "Enter IP address:"); if (ip == "") { return; } if (!IPAddress.TryParse(ip, out IPAddress address)) { MessageBox.Show(this, "Invalid IP address. Enter four numbers from 0 to 255 separted by periods (e.g. '192.168.0.32', etc.)"); return; } mBeacon.Ping(address); }