Formulario revelde ¿ sin causa ?

30/03/2010 - 14:00 por Des As Tre | Informe spam
A los buenos días.
Alguien puede decir que bobada estoy haciendo, y de la cual no encuentro la causa?

frmCierreAño es un formulario
mrc2 es un marco en frmCierreAño
Casilla es un control Public


Sub Mostrar_Formulario_Con_Errores()

With frmCierreAño ' Aparto el marco2. Muestro el listbox que llenaré con los errores.

.mrc2.Left = 0

End With

With .lbErr: .Left = mrc2.Width + 1 / 8 * frmCierreAño.Width: .Visible = True: End With

With .etNota: .Left = lbErr.Left: .Top = 6: .Width = lbErr.Width: .Height = : End With

With .etNota: .BackColor = Rojo: .Caption = "Diario con Errores": End With

.cmdVerificar.Visible = False

With .cbImpErr: .BackColor = Rojo: .Visible = True: End With

End With



'*********** Esta parte no funciona ¿ Donde esta mi genialidad?***



' hay: 2 label, 2 Texbox, 2 Commandbutton, 5 optionbutton



For Each Casilla In frmCierreAño.mrc2.Controls

If Casilla.Name = cmdSalir Then

Casilla.Visible = True

Else

Casilla.Visible = False

End If

Next Casilla

'********************************************************



' Este sí funciona


For Each Casilla In frmCierreAño.Controls

If TypeOf Casilla Is MSForms.CheckBox Then

If Casilla.GroupName = "infVerificar" Then Casilla.Visible = True

End If

Next Casilla

End Sub


Saludos y ... Excel entes vibraciones
Des As Tres No imprimas, ganemos un árbol... o tres hojinas
.
 

Leer las respuestas

#1 Héctor Miguel
30/03/2010 - 21:21 | Informe spam
hola, Des !

Alguien puede decir que bobada estoy haciendo, y de la cual no encuentro la causa?



=> entre tus lineas (y solo de algunas)...

frmCierreAño es un formulario
mrc2 es un marco en frmCierreAño
Casilla es un control Public



=> como, donde y de que tipo declaraste la variable "Casilla" (???)

Sub Mostrar_Formulario_Con_Errores()
With frmCierreAño ' Aparto el marco2. Muestro el listbox que llenaré con los errores.
.mrc2.Left = 0
End With
...



=> despues del "End With" ya no "debiera" funcionar la referencia (terminada) al "frmCierreAño" (del inicio con el "With") -???-
puedes confirmar (o corregir) que las siguientes lineas (With . : End With) funcionan exactamente como lo esperas ?

'*** Esta parte no funciona Donde esta mi genialidad? ***
' hay: 2 label, 2 Texbox, 2 Commandbutton, 5 optionbutton



=> que tiene que ver esta lista de controles con los controles "Casilla" (?)

For Each Casilla In frmCierreAño.mrc2.Controls
If Casilla.Name = cmdSalir Then
...



=> la propiedad <control>.Name toma y devuelve un tipo de datos "String" (entonces...)
- cmdSalir es alguna variable de tipo String ?
- donde y como la declaras y donde y como le asignas su valor (de tipo string) ?

' Este sí funciona
For Each Casilla In frmCierreAño.Controls
If TypeOf Casilla Is MSForms.CheckBox Then
If Casilla.GroupName = "infVerificar" Then Casilla.Visible = True
End If
Next Casilla
End Sub



=> sin comentarios :))

saludos,
hector.

Preguntas similares