bixel
February 19th, 2009, 04:14 PM
C# VS 2008
I have a function that is doing some necessary stuff depending on the values set in a numericUpDown. The function is triggered by a combobox selection. example
private void ChangeLevels(object sender, EventArgs e)
{
decimal valueSet = numeric_Levels1.Value;
if (newValue == 0)
{
Do STUFF
}
else if (newValue > 0)
{
Do STUFF
}
in Forms I understand that function can be assign to multiple tools, however in this case I want a 2nd set of numericUpDown and a combobox using the same function but be independant of the 1st set. As you can see in the code if I dropped this function in the 2nd set of comboxes it would still be using the 1st numericUpDown. Is there a way I can make this code 'universal' with out duplicating it?
I have a function that is doing some necessary stuff depending on the values set in a numericUpDown. The function is triggered by a combobox selection. example
private void ChangeLevels(object sender, EventArgs e)
{
decimal valueSet = numeric_Levels1.Value;
if (newValue == 0)
{
Do STUFF
}
else if (newValue > 0)
{
Do STUFF
}
in Forms I understand that function can be assign to multiple tools, however in this case I want a 2nd set of numericUpDown and a combobox using the same function but be independant of the 1st set. As you can see in the code if I dropped this function in the 2nd set of comboxes it would still be using the 1st numericUpDown. Is there a way I can make this code 'universal' with out duplicating it?