Multiple Event Handling for the Lazy Ones
Handle code redundancy for many controls in one subroutine
When you want to replace all spaces entered in Textboxes, say
txtH1
,txtH2
,txtH3
,txtH4
, instead of writing separate event handlers like :
Private Sub txtH1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtH1.TextChanged
'Code
End Sub
Private Sub txtH2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtH2.TextChanged
'Code
End Sub
and so on,
Private Sub txtH1to7TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtH1.TextChanged,txtH2.TextChanged, txtH3.TextChanged,txtH4.TextChanged
'Code
End Sub
would do the job.
This can be extended to the same event of any number of the same type of control.