Ver Mensaje Individual
  #5 (permalink)  
Antiguo 10/03/2009, 12:36
Avatar de totigo
totigo
 
Fecha de Ingreso: marzo-2007
Ubicación: America
Mensajes: 103
Antigüedad: 18 años, 2 meses
Puntos: 3
De acuerdo Respuesta: Formulario mdi y campos obligatorios

Podes validar el formulario activo de la siguiente manera:

Código vb:
Ver original
  1. Public Sub validaCampos()
  2. Dim i As Integer
  3.     On Error Resume Next
  4.     For i = 0 To Screen.ActiveForm.Controls.Count - 1
  5.         If TypeOf Screen.ActiveForm.Controls(i) Is TextBox Then
  6.             If Not Len(Screen.ActiveForm.Controls(i).Text) > 0 Then
  7.                 Screen.ActiveForm.Controls(i).SetFocus
  8.                 MsgBox "Debe ingresar un dato en este campo", vbExclamation
  9.             End If
  10. '       ElseIf TypeOf Screen.ActiveForm.Controls(i) Is ComboBox Then
  11. '       ElseIf TypeOf Screen.ActiveForm.Controls(i) Is CheckBox Then
  12. '       ElseIf TypeOf Screen.ActiveForm.Controls(i) Is OptionButton Then
  13.       End If
  14.     Next i
  15. End Sub