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 July 9th, 2006, 01:19 AM
Registered User
 
Join Date: Jul 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to sangram2681 Send a message via Yahoo to sangram2681
Default VB.net beginners

I have 5 textboxes on a window form and 1 commmand button ,i want to clear all 5 text boxes when one click command button here iwant to use control array of form rather than writing textbox.clear for each textbox seperately ,will some one tell me haw,my email id is
[email protected]

 
Old July 11th, 2006, 11:17 AM
Registered User
 
Join Date: Jan 2006
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,
You need something like this: -


 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


Chris


 
Old July 26th, 2006, 07:36 PM
Registered User
 
Join Date: Jul 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to rotero Send a message via Yahoo to rotero
Default


need help also
what is the text box is in the group box? the above code is for all text box within the main form...

 
Old July 26th, 2006, 07:44 PM
Registered User
 
Join Date: Jul 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to rotero Send a message via Yahoo to rotero
Default

i got it instead of declaring a form control you replace this

Dim frm As GroupBox = Me.GroupBox1








Similar Threads
Thread Thread Starter Forum Replies Last Post
C++ projects for beginners 132591 C++ Programming 5 September 2nd, 2011 02:41 AM
vb.net 2008 re: VB.NET databases book bigbearjeff VB.NET 0 June 2nd, 2008 01:22 PM
ASP.Net 2.0 Beginners arcc ASP.NET 2.0 Basics 0 August 16th, 2006 10:43 AM
VB.Net question on Windows VB.Net datagrids dmsousa VS.NET 2002/2003 1 January 19th, 2005 02:45 PM
vb.net 2002 - vb.net 2003 book metalaaron Wrox Book Feedback 0 August 2nd, 2003 10:46 PM





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