private void maskedTextBox1_TypeValidationCompleted(object sender, System.Windows.Forms.TypeValidationEventArgs e) { if (e.IsValidInput) { AppendLog("Type validation succeeded. Message: " + e.Message); ip = e.ReturnValue as IPv5; } else { ip = IPv5.InvalidIPv5; AppendLog("Type validation failed. Message: " + e.Message); this.eventLogTextBox.ScrollToCaret(); } }