how to access Custom EventArgs class in Button click event?

后端 未结 3 780
余生分开走
余生分开走 2021-01-27 03:13

As a follow up to: access values within custom eventargs class

How do I access public variables within custom Eventargs class, using button click or any other method?

3条回答
  •  闹比i
    闹比i (楼主)
    2021-01-27 03:26

    You can't do that. The EventArgs of the Click event is always of type EventArgs; you can't expect it to be of type TraderEventArgs, because the event args is created by the button, and the button doesn't know anything about TraderEventArgs. The only way it could work is if you create your own Button control that raises the event with a TraderEventArgs instead of an EventArgs

提交回复
热议问题