VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Clear all Controls in a Form

by MLazaro (2 Submissions)
Category: Custom Controls/Forms/Menus
Compatability: Visual Basic 4.0 (32-bit)
Difficulty: Unknown Difficulty
Originally Published: Wed 9th August 2000
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Clear all Controls in a Form

Rate Clear all Controls in a Form



Sub ClearControls(frmName As Form)
Dim objObject As Object
Dim I As Long

For I = 0 To frmName.Count - 1
    
    Set objObject = frmName.Controls(I)
    
    If TypeOf objObject Is TextBox Then
        objObject.Text = ""
    ElseIf TypeOf objObject Is CheckBox Then
        objObject.Value = False
    ' ElseIf TypeOf objObject Is ......... Then
    '    objObject.Property = Value
    End If
    
Next I

End Sub



Download this snippet    Add to My Saved Code

Clear all Controls in a Form Comments

No comments have been posted about Clear all Controls in a Form. Why not be the first to post a comment about Clear all Controls in a Form.

Post your comment

Subject:
Message:
0/1000 characters