Public Sub ClearFormControls(ByRef obj As Object) Dim objCont As Object For Each objCont In obj.Controls If objCont.Controls.Count > 0 Then ClearFormControls(objCont) ''Call recursively if objcont is container control Else 'Check type of objcont to clear the control Select Case objCont.GetType.ToString.ToUpper Case "System.Windows.Forms.TextBox".ToUpper objCont.Text = "" Case "System.Windows.Forms.ComboBox".ToUpper objCont.SelectedIndex = -1 Case "System.Windows.Forms.DateTimePicker".ToUpper objCont.Format = DateTimePickerFormat.Custom objCont.CustomFormat = "dd-MMM-yyyy" objCont.value = mdtCurrentDate If objCont.ShowCheckBox Then objCont.Checked = False End IfCase "System.Windows.Forms.CheckBox".ToUpper, "System.Windows.Forms.RadioButton".ToUpper objCont.Checked = False End Select End If Next End Sub