private void ConnectButton_Click(object sender, EventArgs e) { if (RegexTests.checkIP(Adress.Text) && RegexTests.isPortNumber(PortBox.Text)) { DialogResult = DialogResult.OK; this.Close(); } else { MessageBox.Show("Niepoprawny adres IP lub/i numer portu", "Błąd", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void Adress_TextChanged(object sender, EventArgs e) { Adress.BackColor = (RegexTests.checkIP(Adress.Text)) ? Color.LightGreen : Color.Red; }