private void TextBox2_TextChanged(object sender, EventArgs e) { mUOM = mApp.ActiveDocument.UnitsOfMeasure; if (TextBox2.Text.Length > 0) { if (mUOM.IsExpressionValid(TextBox2.Text, UnitsTypeEnum.kDefaultDisplayLengthUnits)) { TextBox2.ForeColor = System.Drawing.Color.Black; Button2.Enabled = true; } else { TextBox2.ForeColor = System.Drawing.Color.Red; Button2.Enabled = false; } } }