Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 42215

VS 2010 [RESOLVED] Is there such thing as generic events for controls?

$
0
0
Hiya,

I've got a form with 50 text controls. The common thing within these controls are their label which are incremented as such: txtOutcome01, txtOutcome02, etc...

I want to be able to double click on any of the 50 text controls and have it run a bit of code specific to those 50 text boxes. I could easily do it for one by simply using the below:

Code:

Private Sub txtOutcome01_DoubleClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtOutcome01.DoubleClick

      msgbox "blah blah blah"

    End Sub

The easy solution would be to create 50 Sub Functions but that is very messy. Excuse the terminology but is there any sort of way of using a generic DoubleClick event that would only apply to the txtOutcome01-50 text controls? Hope that makes sense?

Cheers,
J

Viewing all articles
Browse latest Browse all 42215

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>