raiseevent

How do I fire an event in VB.NET code?

不问归期 提交于 2019-11-30 13:42:59
问题 I have a form that has a start button (to allow users to run the processes over and over if they wish), and I want to send a btnStart.Click event when the form loads, so that the processes start automatically. I have the following function for the btnStart.Click event, but how do I actually tell Visual Basic 'Pretend someone has clicked the button and fire this event'? I've tried going very simple, which essentially works. However, Visual Studio gives me a warning Variable 'sender' is used

How do i raise an event in a usercontrol and catch it in mainpage?

微笑、不失礼 提交于 2019-11-27 10:31:46
I have a UserControl , and I need to notify the parent page that a button in the UserControl was clicked. How do I raise an event in the UserControl and catch it on the Main page? I tried using static , and many suggested me to go for events! Jemes Check out Event Bubbling -- http://msdn.microsoft.com/en-us/library/aa719644%28vs.71%29.aspx Edit to add a quick example: (and additional edit to improve formatting) User Control public event EventHandler StatusUpdated; private void FunctionThatRaisesEvent() { //Null check makes sure the main page is attached to the event if (this.StatusUpdated !=

How do i raise an event in a usercontrol and catch it in mainpage?

梦想与她 提交于 2019-11-26 17:57:11
问题 I have a UserControl , and I need to notify the parent page that a button in the UserControl was clicked. How do I raise an event in the UserControl and catch it on the Main page? I tried using static , and many suggested me to go for events! 回答1: Check out Event Bubbling -- http://msdn.microsoft.com/en-us/library/aa719644%28vs.71%29.aspx Edit to add a quick example: (and additional edit to improve formatting) User Control public event EventHandler StatusUpdated; private void