borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (Highlight a Column)Next Topic (Language support in VB.Net ??) New Topic New Poll Post Reply
AndreaVB Forum : VB.Net : Clear Textboxes Using For Each and Typeof in VB.Net
Poster Message
Chris_871
Level: Master


Registered: 30-11-2002
Posts: 106

icon Clear Textboxes Using For Each and Typeof in VB.Net

Hi Friends
We can able to clear textboxes(Other controls also)in VB.Net
like VB. but u have to make slight changes.

Create one window form and place one Groupbox control and keep some textboxes inside the groupbox.

Now write the following code.


Public Sub cleartext(ByVal frm As Form)
            Dim ctrl1, ctrl2 As Control
            For Each ctrl1 In frm.Controls
                If TypeOf ctrl1 Is GroupBox Then
                   For Each ctrl2 In ctrl1.Controls
                        If TypeOf ctrl2 Is TextBox Then
                              ctrl2.Text = ""
                        End If
                    Next
                End If
            Next
        End Sub


Now u can call the procedure by passing the form object.

by
Chris


[Edited by Chris_871 on 20-09-2003 at 12:26 AM GMT]

[Edited by Chris_871 on 21-11-2003 at 10:07 AM GMT]

18-09-2003 at 04:21 PM
View Profile Send Email to User Show All Posts | Quote Reply
AndreaVB Forum : VB.Net : Clear Textboxes Using For Each and Typeof in VB.Net
Previous Topic (Highlight a Column)Next Topic (Language support in VB.Net ??) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder