0

is there a way to use a variable without stating which one?

I.e. Decide which button to use if they are named button1 button2... etc. and then run a method with that button?

26th Jul 2017, 7:02 PM
Chase
3 Antworten
+ 1
Do you perhaps mean like a function? Such as: public void myFunction(button) { // Whatever the heck this function does. } // Function call myFunction(button); Or am I missing something?
26th Jul 2017, 7:53 PM
Christian Barraza
Christian Barraza - avatar
0
You can bind all buttons to the same button_click event and make a switch statement in de button_click to call the right method. Are you using wpf ? the you need to bind to the command parameter. https://www.codeproject.com/Articles/238657/How-to-use-Commands-in-WPF
26th Jul 2017, 9:12 PM
sneeze
sneeze - avatar
0
@Trackrise nope your spot on
26th Jul 2017, 11:20 PM
Chase