Ver Mensaje Individual
  #5 (permalink)  
Antiguo 07/07/2011, 10:08
Avatar de HaverRamirez
HaverRamirez
 
Fecha de Ingreso: junio-2011
Ubicación: Guatemala
Mensajes: 273
Antigüedad: 13 años, 7 meses
Puntos: 33
Respuesta: Macrosustitucion en Visual Basic 2010

Eso es Recursión
dentro de basic se usa procedimientos para recorrer los datos, por ejemplo

Código vb:
Ver original
  1. Public Function RecorreValida(ByVal G As GroupBox) As Boolean
  2.         Try
  3.             For Each C As Control In G.Controls
  4.  
  5.                
  6.                 If TypeOf C Is Combobox Then
  7. 'el tipo isvalidselection es parte del objeto personalisado regresa true o false
  8.                    If CType(C, Combobox).IsValidSelection = False Then
  9. 'vincula error es un proc donde se adhiere un error provider y se despliegan mensajes
  10.                        VinculaError(C)
  11.                         Return False
  12.                     End If
  13.                 End If
  14.                 If TypeOf C Is TextBox Then
  15.                     If String.IsNullOrEmpty(CType(C, CONACC.TextBoxAlfanumerico).Text) Then
  16.                         VinculaError(C)
  17.                         Return False
  18.                     End If
  19.                 End If
  20.                 'aqui vuelvo a llamar la misma funcion, o sea esta, pero le mando el groupbox y asi sucesivamente
  21.  
  22.                 if typeof c is groupbox then
  23.                 recorreValida(c)
  24.                 end if
  25.                
  26.             Next
  27.             Return True
  28.         Catch ex As Exception
  29.             MsgBox(ex.Message)
  30.         End Try
  31.     End Function