Public Sub EmptyControls(ByVal Value As Control)
For Each control As Object In Value.Controls
If control.TabIndex = 1 Then
control.Focus()
End If
If TypeOf control Is TextBox Then
control.Text = String.Empty
End If
If TypeOf control Is ComboBox Then
control.selectedValue = String.Empty
End If
If TypeOf control Is RadioButton Then
control.Checked = False
End If
If TypeOf control Is CheckBox Then
control.Checked = False
End If
If TypeOf control Is GroupBox Then
EmptyControls(control)
End If
If TypeOf control Is Panel Then
EmptyControls(control)
End If
If TypeOf control Is TabControl Then
EmptyControls(control)
End If
If TypeOf control Is TabPage Then
EmptyControls(control)
End If
If TypeOf control Is SplitContainer Then
EmptyControls(control)
End If
If TypeOf control Is DataTable Then
control.Dispose()
End If
If TypeOf control Is DataSet Then
control.dispose()
End If
If TypeOf control Is MaskedTextBox Then
control.text = String.Empty
End If
Next
End Sub
viernes, abril 29, 2011
Función para limpiar controles en Vb.net
Esta sencilla funcion permite limpiar los controles de un formulario.
Suscribirse a:
Comentarios de la entrada (Atom)
No hay comentarios.:
Publicar un comentario