how to handle programmatically added button events? c#

前端 未结 6 1753
悲哀的现实
悲哀的现实 2020-12-03 07:39

I\'m making a windows forms application using C#. I add buttons and other controls programmatically at run time. I\'d like to know how to handle those buttons\' click events

6条回答
  •  难免孤独
    2020-12-03 08:17

    seems like this works, while adding a tag with each element of the array

    Button button = sender as Button;
    

    do you know of a better way?

提交回复
热议问题