private int checkSN(TextBox box) { int dot = 0; if (int.TryParse(box.Text, out dot)) { if (dot < 8 || dot > 32) { box.BackColor = Color.Red; ERRBox.AppendText("Ungueltiges Subnetz" + Environment.NewLine); } else { box.BackColor = Color.Green; } } else { box.BackColor = Color.Red; ERRBox.AppendText("Ungueltiges Subnetz" + Environment.NewLine); } return(dot); }
private int checkIP(TextBox box) { int dot = 0; if (int.TryParse(box.Text, out dot)) { if (dot < 0 || dot > 255) { box.BackColor = Color.Red; ERRBox.AppendText("Ungueltige Zahl im" + getTextBoxName(box.Name) + Environment.NewLine); } else { box.BackColor = Color.Green; } } else { box.BackColor = Color.Red; ERRBox.AppendText("Ungueltige Zeichen im" + getTextBoxName(box.Name) + Environment.NewLine); } return(dot); }