Hola a todos, tengo un formulario bastante grande, donde hay varios checkbox y optionbutton, y dependiendo de los chequeados muestra unos y/o oculta otros
este es el primero de 5 que hay, pero el codigo lo veo muy largo
Código:
Private Sub Agregar_Intervencion1_Click()
If Agregar_Intervencion1 = 1 Then
CheckMultiple1.Visible = True
CheckBilateral1.Visible = True
Agregar_Intervencion2.Enabled = True
Else
Agregar_Intervencion2.Enabled = False
Agregar_Intervencion3.Enabled = False
Agregar_Intervencion4.Enabled = False
Agregar_Intervencion5.Enabled = False
Agregar_Intervencion2.Value = 0
Agregar_Intervencion3.Value = 0
Agregar_Intervencion4.Value = 0
Agregar_Intervencion5.Value = 0
CheckMultiple1.Value = 0
CheckMultiple2.Value = 0
CheckMultiple3.Value = 0
CheckMultiple4.Value = 0
CheckMultiple5.Value = 0
CheckBilateral1.Value = 0
CheckBilateral2.Value = 0
CheckBilateral3.Value = 0
CheckBilateral4.Value = 0
CheckBilateral5.Value = 0
MismaVia1.Value = 0
DistVia1.Value = 0
MismaVia2.Value = 0
DistVia2.Value = 0
MismaVia3.Value = 0
DistVia3.Value = 0
MismaVia4.Value = 0
DistVia4.Value = 0
MismaVia5.Value = 0
DistVia5.Value = 0
CheckMultiple1.Visible = False
CheckBilateral1.Visible = False
MismaVia1.Visible = False
DistVia1.Visible = False
TextBilateral1.Text = 0
TextMultiple1.Text = 0
TextDistinta1.Text = 0
TextMisma1.Text = 0
TextBilateral2.Text = 0
TextMultiple2.Text = 0
TextDistinta2.Text = 0
TextMisma2.Text = 0
TextBilateral3.Text = 0
TextMultiple3.Text = 0
TextDistinta3.Text = 0
TextMisma3.Text = 0
TextBilateral4.Text = 0
TextMultiple4.Text = 0
TextDistinta4.Text = 0
TextMisma4.Text = 0
TextBilateral5.Text = 0
TextMultiple5.Text = 0
TextDistinta5.Text = 0
TextMisma5.Text = 0
End If
End Sub
Private Sub CheckBilateral1_Click()
If CheckBilateral1 = 1 Then
CheckMultiple1.Visible = False
CheckMultiple1.Value = 0
MismaVia1.Visible = False
DistVia1.Visible = False
TextBilateral1.Text = 1
Else
CheckMultiple1.Visible = True
CheckBilateral1.Value = 0
TextBilateral1.Text = 0
End If
End Sub
Private Sub CheckMultiple1_Click()
If CheckMultiple1 = 1 Then
CheckBilateral1.Visible = False
CheckBilateral1.Value = 0
TextMultiple1.Text = 1
MismaVia1.Visible = True
DistVia1.Visible = True
Else
CheckBilateral1.Visible = True
CheckBilateral1.Value = 0
MismaVia1.Visible = False
DistVia1.Visible = False
TextMultiple1.Text = 0
TextDistinta1.Text = 0
TextMisma1.Text = 0
MismaVia1.Value = 0
DistVia1.Value = 0
End If
End Sub
Private Sub MismaVia1_click()
If MismaVia1.Value = True Then
TextMisma1.Text = 1
TextDistinta1.Text = 0
End If
End Sub
Private Sub DistVia1_click()
If DistVia1.Value = True Then
TextDistinta1.Text = 1
TextMisma1.Text = 0
End If
End Sub
Aqui la leyenda de cada uno
Agregar_Intervencion1, 2, 3, 4 y 5 (CheckBox)
CheckBilateral1, 2, 3, 4 y 5 (CheckBox)
CheckMultiple1, 2, 3, 4 y 5 (CheckBox)
MismaVia1, 2, 3, 4, y 5 (OptionButton)
DistVia1, 2, 3, 4, y 5 (OptionButton)
de estos tengo 5, este es el primero, en el segundo saco los controles 1, en el tercero los controles 2 y asi sucesivamente
alguna idea o sugerencia
Muchas Gracias