Yeah. Small thing.. but I didn’t notice about that.. I think I might never notice about that if my friend “Lu taw lay” didn’t tell me…
Actually, when I was working on automation team, we needed to write the automation script for ComponentOne Control to ensure whether each property/ method and event of a particular control are working fine or not. When we were writing the scripts, we needed to add/remove the event at runtime. In case of removing a event from the control, we wrote like this.button1.Click -= null wrongly in our script. and we didn’t notice about that til the time my friend tell me.
If CheckBox1.Checked Then
AddHandler Button1.Click, AddressOf button1_Click
RemoveHandler Button1.Click, AddressOf button1_Click
this.button1.Click += new System.EventHandler(this.button1_Click);
this.button1.Click -= new System.EventHandler(this.button1_Click);
Handling Events in .NET