V
victor
Hello guys,
I'm stuck at the following situation, please advise.
In my app there exists several control buttons (radio and push).
One of the methods is the following:
private void ManageControl (string ButtonName)
{
switch (ButtonName)
{
case "Button1"
{
Button1.BackColor=Color.FromArgb(nred,ngreen,nblue);
....
}
case "Button2"
{
Button2.BackColor=Color.FromArgb(nred,ngreen,nblue);
....
}
....
}
The case content is all the same except for the part of the Control
object (Button1, Button2, ...etc.); therefore I want to shrink it to
just one case parameterized with the appropriate button control name
which needs to be managed.
How do I pass these Control Name Button1, Button2 etc.) property to
the 'ManageControl' method?
Add parameter out/ref/object/.... ?
Thanks for your time!
greetz, victor
I'm stuck at the following situation, please advise.
In my app there exists several control buttons (radio and push).
One of the methods is the following:
private void ManageControl (string ButtonName)
{
switch (ButtonName)
{
case "Button1"
{
Button1.BackColor=Color.FromArgb(nred,ngreen,nblue);
....
}
case "Button2"
{
Button2.BackColor=Color.FromArgb(nred,ngreen,nblue);
....
}
....
}
The case content is all the same except for the part of the Control
object (Button1, Button2, ...etc.); therefore I want to shrink it to
just one case parameterized with the appropriate button control name
which needs to be managed.
How do I pass these Control Name Button1, Button2 etc.) property to
the 'ManageControl' method?
Add parameter out/ref/object/.... ?
Thanks for your time!
greetz, victor