Solved

clear button

Posted on 2008-10-05
4
161 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
  • 2
  • 2
4 Comments
 
LVL 69

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 69

Accepted Solution

by:
Éric Moreau earned 500 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
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.

708 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now