[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

clear button

Posted on 2008-10-05
4
Medium Priority
?
178 Views
Last Modified: 2010-04-30
i want the clear button to clear the whole thing at one time. i got some code but i have to keep on hitting clear to clear each text box. help please. thank you.
Private Sub Clear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Dim Ctl As Control
        For Each Ctl In Me.Controls
            If TypeOf Ctl Is TextBox Then
                Ctl.Text = ""
            End If
        Next
    End Sub

Open in new window

0
Comment
Question by:elrayiss
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 22645738
which button do you have to keep on hitting? from what I see, hitting button2 should clear all the textbox but considering your other questions, you have code in the TextChanged event of some textbox that short-circuit the clearing.
0
 

Author Comment

by:elrayiss
ID: 22646264
what im doing is that when im hitting the clear button on one textbox at a time is clearing i want it to get cleared from one hit.
0
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 2000 total points
ID: 22646401
set a class level variable to True before your loop, in all your textchanged event handler if the variable is true, set the textbox to empty otherwise do your process.
0
 

Author Closing Comment

by:elrayiss
ID: 31503223
excellent.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you haven’t already, I encourage you to read the first article (http://www.experts-exchange.com/articles/18680/An-Introduction-to-R-Programming-and-R-Studio.html) in my series to gain a basic foundation of R and R Studio.  You will also find the …
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.
Suggested Courses

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question