I am trying to implement a button that deletes a text in a textbox
. However, the catch here is that I will have multiple textbox
that have multiple button
that deletes the text respectively. I've tried a weird approach to this by having a switch
case that gets the button
name to deal with different textbox
such as follows:
switch(btn.Name)
{
case "button1": textbox1.Clear();
break;
case "button2": textbox2.Clear();
break;
}
Although this solves the issue, but I find this really not robust and not practical in terms of the design. So I would like to ask if there is anyway to do this in a much better way? Thank you!