by Elliot McCardle (3 Submissions)
Category: Custom Controls/Forms/Menus
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Tue 6th May 2003
Date Added: Mon 8th February 2021
Rating: (1 Votes)
I had several forms with several controls on each. I wanted to clear each control, but I wanted to make it as painless as possible. This code
Dim sMask As String
For Each Control In frm.Controls
If TypeOf Control Is TextBox Or TypeOf Control Is ComboBox Then
Control.Text = "" 'Clear text
End If
If TypeOf Control Is MaskEdBox Then
With Control
sMask = .Mask 'Save the existing mask
.Mask = "" 'Clear mask
.Text = "" 'Clear text
.Mask = sMask 'Reset mask
End With
End If
If TypeOf Control Is DTPicker Then
Control.Date = Date 'Set to current date
End If
Next Control
End Sub
No comments have been posted about I had several forms with several controls on each. I wanted to clear each control, but I wanted to . Why not be the first to post a comment about I had several forms with several controls on each. I wanted to clear each control, but I wanted to .