Wrox Programmer Forums
|
VB.NET 2002/2003 Basics For coders who are new to Visual Basic, working in .NET versions 2002 or 2003 (1.0 and 1.1).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB.NET 2002/2003 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 28th, 2006, 05:29 AM
Registered User
 
Join Date: Jan 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default find textbox in window form

hi all,
i have a form name "form1". in this form i have 20 textbox. i want to clear all the text in these textbox.
1. i am not want to write like this textbox1.clear ,textbox2.clear ETC.
i want to run a loop an clear all the text in the textbox how can i do this
or
any one can simple way given to me
Pls give with example


 
Old April 28th, 2006, 08:22 AM
Registered User
 
Join Date: Jan 2006
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default


 Dim ctl As Control
 Dim frm As Form = Me

        For Each ctl In frm.Controls
            If TypeOf ctl Is TextBox Then
                ctl.Text = ""
            End If
        Next ctl

This should fit the bill.






Similar Threads
Thread Thread Starter Forum Replies Last Post
SetFocus on a textbox when form load snowydust VB How-To 9 February 10th, 2017 12:43 AM
Form Textbox problem Simba Other Programming Languages 0 February 1st, 2007 05:44 PM
How To passing the data in textbox to other form? lammyhk VB How-To 7 July 21st, 2005 05:35 AM
Query: getting criteria from a textbox in a form lguzman Access VBA 2 November 1st, 2004 10:16 AM
Can't find form mschenk Access 4 December 2nd, 2003 01:31 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.