It's a bit tough to follow your code - did you mean to the valueSet variable called newValue or is newValue a class field? (as a side issue always a good reason to preface class fields with an underscore).
At any rate, if we assume decimal valueSet should have been named newValue. Just pull out the code that does stuff into another method.
Code:private void ChangeLevels(object sender, EventArgs e) { SetStuff( numeric_Levels1.Value ); } private void ChangeMoreLevels(object sender, EventArgs e) { SetStuff( numeric_Levels2.Value ); } private void SetStuff( decimal value ) { if ( value == 0) { // Do STUFF } else if (value > 0) { // Do other STUFF } }




Reply With Quote