private void Const_Value_TextChanged(object sender, TextChangedEventArgs e) { //If the selected constant is valid, update the values in the script if (Const_ListBox.SelectedIndex > -1) { //Exclude changes that would clear or add confusing characters to it //I also wanted to have a sanity check for the type of constant (Decimal, Hex, Binary) //to only allow valid numbers, but this caused stack overflows I couldn't figure the cause of. if (Const_Value.Text.Trim() != "" && !Const_Value.Text.Contains(';') && !Const_Value.Text.Contains('=')) { MGSOGlobals.SetConstantValue(Const_ListBox.SelectedItem.ToString(), Const_Value.Text); } } }