Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7967633
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T06:57:18+00:00 2026-06-04T06:57:18+00:00

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) _ Handles Button1.Click EmptyTextBoxValues(Me)

  • 0
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) _
    Handles Button1.Click  
    EmptyTextBoxValues(Me)  
End Sub  

Private Sub EmptyTextBoxValues(ByVal parent As Control)  
    For Each c As Control In parent.Controls  
        If (c.Controls.Count > 0) Then  
            EmptyTextBoxValues(c)  
        Else  
            If TypeOf c Is TextBox Then  
                CType(c, TextBox).Text = ""  
            End If  
        End If  
    Next  
End Sub  

This sub is for to clear all textboxes value, i just need to know how did it work ??

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T06:57:18+00:00Added an answer on June 4, 2026 at 6:57 am

    The EmptyTextBoxValues sub recursively calls all child controls (if they exists) – if non exist, it checks if they are a text box and if so, clears it.

    To start – it loops through every child control belonging to the passed in control:

    For Each c As Control In parent.Controls
    

    It then tests whether the child control has any child controls of its own, and if so, calls itself with the child control:

        If (c.Controls.Count > 0) Then  
            EmptyTextBoxValues(c)  
    

    If no such child controls exist on the child control, a test is made whether the type of the control is of TextBox and if so, it is cleared:

        Else  
            If TypeOf c Is TextBox Then  
                CType(c, TextBox).Text = ""  
            End If  
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Protected Sub btnLocalSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnLocalSubmit.Click Dim logic
Protected Sub lnkContractors_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles lnkContractors.Click If Context.User.IsInRole("HOD")
Protected Sub btnDelete_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnDelete.Click Dim ResourceObject
codebehind Protected Sub btnDelete_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnDelete.Click Dim
I am using following code in rowdatabound function. Protected Sub gvwMileStone_RowDataBound(ByVal sender As System.Object,
Here is the code for the button click event; Protected Sub CompetenciesButton_Click(ByVal sender As
I am using VB.NET and below code on button click event. Protected Sub ibtnSendInvites_Click(ByVal
i have this code it keeps giving me error Protected Sub Button2_Click(ByVal sender As
I have code like the following in a UserControl: Protected Overrides Sub Render(ByVal writer
I'm using the following snippit of code to update an entry: Protected Sub Button2_Click(ByVal

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.