Set all controls on a form to null


/ Published in: Visual Basic
Save to your folder(s)



Copy this code and paste it in your HTML
  1. Private Sub cmdClear_Click()
  2. On Error GoTo Err_cmdClear
  3.  
  4. Dim Ctl As Control
  5. On Error Resume Next
  6. For Each Ctl In Me.Controls
  7. Ctl.Value = Null
  8. Next Ctl
  9.  
  10. Exit_cmdClear:
  11. Exit Sub
  12.  
  13. Err_cmdClear:
  14. MsgBox Err.Description
  15. Resume Exit_cmdClear
  16.  
  17. End Sub

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.