Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27041

Clearing Textboxes: Using Handlers Vs. For Each Loop

$
0
0
The purpose of my question is to strengthen my understanding of the Handles Clause. I want to code a button that will clear multiple Textboxes using this method. So far, I've figured out how to accomplish this task using a For Each Loop through Me.Controls, as so:

Code:

        For Each x As Control In Me.Controls
            If TypeOf x Is TextBox Then
                X.Text = ""
            End If
        Next

Can I accomplish this using the Handles Clause as well?

My understanding is I can use the e variable from class EventArgs as a reference to handle anything I declare to be handled by the Handles Clause in the Sub procedure statement. Is this correct?

Viewing all articles
Browse latest Browse all 27041

Trending Articles



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