simplificar un select case
Publicado por Carlos Pulgarin (136 intervenciones) el 08/11/2006 20:14:20
tengo una linea de codigo muy extensa para un select case de 8 opciones. habra una posibilidad de reducirlo al maximo esta es la linea de codigo:
Select Case Contador
Case 1
Me.TxtApellido1.Enabled = True
Me.TxtApellido1.BackColor = &H80000005
Me.TxtNombre1.Enabled = True
Me.TxtNombre1.BackColor = &H80000005
Me.TxtSexo1.Enabled = True
Me.TxtSexo1.BackColor = &H80000005
Me.TxtHabt1.Enabled = True
Me.TxtHabt1.BackColor = &H80000005
Me.TxtCI1.Enabled = True
Me.TxtCI1.BackColor = &H80000005
Me.TxtDirc1.Enabled = True
Me.TxtDirc1.BackColor = &H80000005
Me.TxtObsr1.Enabled = True
Me.TxtObsr1.BackColor = &H80000005
Me.CmbEdad1.Enabled = True
Me.CmbEdad1.BackColor = &H80000005
Me.TxtHist1.Enabled = True
Me.TxtHist1.BackColor = &H80000005
Case 2
Me.TxtApellido1.Enabled = True
Me.TxtApellido1.BackColor = &H80000005
Me.TxtNombre1.Enabled = True
Me.TxtNombre1.BackColor = &H80000005
Me.TxtSexo1.Enabled = True
Me.TxtSexo1.BackColor = &H80000005
Me.TxtHabt1.Enabled = True
Me.TxtHabt1.BackColor = &H80000005
Me.TxtCI1.Enabled = True
Me.TxtCI1.BackColor = &H80000005
Me.TxtDirc1.Enabled = True
Me.TxtDirc1.BackColor = &H80000005
Me.TxtObsr1.Enabled = True
Me.TxtObsr1.BackColor = &H80000005
Me.CmbEdad1.Enabled = True
Me.CmbEdad1.BackColor = &H80000005
Me.TxtHist1.Enabled = True
Me.TxtHist1.BackColor = &H80000005
Me.TxtApellido2.Enabled = True
Me.TxtApellido2.BackColor = &H80000005
Me.TxtNombre2.Enabled = True
Me.TxtNombre2.BackColor = &H80000005
Me.TxtSexo2.Enabled = True
Me.TxtSexo2.BackColor = &H80000005
Me.TxtHabt2.Enabled = True
Me.TxtHabt2.BackColor = &H80000005
Me.TxtCI2.Enabled = True
Me.TxtCI2.BackColor = &H80000005
Me.TxtDirc2.Enabled = True
Me.TxtDirc2.BackColor = &H80000005
Me.TxtObsr2.Enabled = True
Me.TxtObsr2.BackColor = &H80000005
Me.CmbEdad2.Enabled = True
Me.CmbEdad2.BackColor = &H80000005
Me.TxtHist2.Enabled = True
Me.TxtHist2.BackColor = &H80000005
Case 3
Me.TxtApellido1.Enabled = True
Me.TxtApellido1.BackColor = &H80000005
Me.TxtNombre1.Enabled = True
Me.TxtNombre1.BackColor = &H80000005
Me.TxtSexo1.Enabled = True
Me.TxtSexo1.BackColor = &H80000005
Me.TxtHabt1.Enabled = True
Me.TxtHabt1.BackColor = &H80000005
Me.TxtCI1.Enabled = True
Me.TxtCI1.BackColor = &H80000005
Me.TxtDirc1.Enabled = True
Me.TxtDirc1.BackColor = &H80000005
Me.TxtObsr1.Enabled = True
Me.TxtObsr1.BackColor = &H80000005
Me.CmbEdad1.Enabled = True
Me.CmbEdad1.BackColor = &H80000005
Me.TxtHist1.Enabled = True
Me.TxtHist1.BackColor = &H80000005
Me.TxtApellido2.Enabled = True
Me.TxtApellido2.BackColor = &H80000005
Me.TxtNombre2.Enabled = True
Me.TxtNombre2.BackColor = &H80000005
Me.TxtSexo2.Enabled = True
Me.TxtSexo2.BackColor = &H80000005
Me.TxtHabt2.Enabled = True
Me.TxtHabt2.BackColor = &H80000005
Me.TxtCI2.Enabled = True
Me.TxtCI2.BackColor = &H80000005
Me.TxtDirc2.Enabled = True
Me.TxtDirc2.BackColor = &H80000005
Me.TxtObsr2.Enabled = True
Me.TxtObsr2.BackColor = &H80000005
Me.CmbEdad2.Enabled = True
Me.CmbEdad2.BackColor = &H80000005
Me.TxtHist2.Enabled = True
Me.TxtHist2.BackColor = &H80000005
Me.TxtApellido3.Enabled = True
Me.TxtApellido3.BackColor = &H80000005
Me.TxtNombre3.Enabled = True
Me.TxtNombre3.BackColor = &H80000005
Me.TxtSexo3.Enabled = True
Me.TxtSexo3.BackColor = &H80000005
Me.TxtHabt3.Enabled = True
Me.TxtHabt3.BackColor = &H80000005
Me.TxtCI3.Enabled = True
Me.TxtCI3.BackColor = &H80000005
Me.TxtDirc3.Enabled = True
Me.TxtDirc3.BackColor = &H80000005
Me.TxtObsr3.Enabled = True
Me.TxtObsr3.BackColor = &H80000005
Me.CmbEdad3.Enabled = True
Me.CmbEdad3.BackColor = &H80000005
Me.TxtHist3.Enabled = True
Me.TxtHist3.BackColor = &H80000005
Case 4
Me.TxtApellido1.Enabled = True
Me.TxtApellido1.BackColor = &H80000005
Me.TxtNombre1.Enabled = True
Me.TxtNombre1.BackColor = &H80000005
Me.TxtSexo1.Enabled = True
Me.TxtSexo1.BackColor = &H80000005
Me.TxtHabt1.Enabled = True
Me.TxtHabt1.BackColor = &H80000005
Me.TxtCI1.Enabled = True
Me.TxtCI1.BackColor = &H80000005
Me.TxtDirc1.Enabled = True
Me.TxtDirc1.BackColor = &H80000005
Me.TxtObsr1.Enabled = True
Me.TxtObsr1.BackColor = &H80000005
Me.CmbEdad1.Enabled = True
Me.CmbEdad1.BackColor = &H80000005
Me.TxtHist1.Enabled = True
Me.TxtHist1.BackColor = &H80000005
Me.TxtApellido2.Enabled = True
Me.TxtApellido2.BackColor = &H80000005
Me.TxtNombre2.Enabled = True
Me.TxtNombre2.BackColor = &H80000005
Me.TxtSexo2.Enabled = True
Me.TxtSexo2.BackColor = &H80000005
Me.TxtHabt2.Enabled = True
Me.TxtHabt2.BackColor = &H80000005
Me.TxtCI2.Enabled = True
Me.TxtCI2.BackColor = &H80000005
Me.TxtDirc2.Enabled = True
Me.TxtDirc2.BackColor = &H80000005
Me.TxtObsr2.Enabled = True
Me.TxtObsr2.BackColor = &H80000005
Me.CmbEdad2.Enabled = True
Me.CmbEdad2.BackColor = &H80000005
Me.TxtHist2.Enabled = True
Me.TxtHist2.BackColor = &H80000005
Me.TxtApellido3.Enabled = True
Me.TxtApellido3.BackColor = &H80000005
Me.TxtNombre3.Enabled = True
Me.TxtNombre3.BackColor = &H80000005
Me.TxtSexo3.Enabled = True
Me.TxtSexo3.BackColor = &H80000005
Me.TxtHabt3.Enabled = True
Me.TxtHabt3.BackColor = &H80000005
Me.TxtCI3.Enabled = True
Me.TxtCI3.BackColor = &H80000005
Me.TxtDirc3.Enabled = True
Me.TxtDirc3.BackColor = &H80000005
Me.TxtObsr3.Enabled = True
Me.TxtObsr3.BackColor = &H80000005
Me.CmbEdad3.Enabled = True
Me.CmbEdad3.BackColor = &H80000005
Me.TxtHist3.Enabled = True
Me.TxtHist3.BackColor = &H80000005
Me.TxtApellido4.Enabled = True
Me.TxtApellido4.BackColor = &H80000005
Me.TxtNombre4.Enabled = True
Me.TxtNombre4.BackColor = &H80000005
Me.TxtSexo4.Enabled = True
Me.TxtSexo4.BackColor = &H80000005
Me.TxtHabt4.Enabled = True
Me.TxtHabt4.BackColor = &H80000005
Me.TxtCI4.Enabled = True
Me.TxtCI4.BackColor = &H80000005
Me.TxtDirc4.Enabled = True
Me.TxtDirc4.BackColor = &H80000005
Me.TxtObsr4.Enabled = True
Me.TxtObsr4.BackColor = &H80000005
Me.CmbEdad4.Enabled = True
Me.CmbEdad4.BackColor = &H80000005
Me.TxtHist4.Enabled = True
Me.TxtHist4.BackColor = &H80000005
............ asi susecivamente hasta llegar al select 8 se pueden imaginar lo largo que es
Select Case Contador
Case 1
Me.TxtApellido1.Enabled = True
Me.TxtApellido1.BackColor = &H80000005
Me.TxtNombre1.Enabled = True
Me.TxtNombre1.BackColor = &H80000005
Me.TxtSexo1.Enabled = True
Me.TxtSexo1.BackColor = &H80000005
Me.TxtHabt1.Enabled = True
Me.TxtHabt1.BackColor = &H80000005
Me.TxtCI1.Enabled = True
Me.TxtCI1.BackColor = &H80000005
Me.TxtDirc1.Enabled = True
Me.TxtDirc1.BackColor = &H80000005
Me.TxtObsr1.Enabled = True
Me.TxtObsr1.BackColor = &H80000005
Me.CmbEdad1.Enabled = True
Me.CmbEdad1.BackColor = &H80000005
Me.TxtHist1.Enabled = True
Me.TxtHist1.BackColor = &H80000005
Case 2
Me.TxtApellido1.Enabled = True
Me.TxtApellido1.BackColor = &H80000005
Me.TxtNombre1.Enabled = True
Me.TxtNombre1.BackColor = &H80000005
Me.TxtSexo1.Enabled = True
Me.TxtSexo1.BackColor = &H80000005
Me.TxtHabt1.Enabled = True
Me.TxtHabt1.BackColor = &H80000005
Me.TxtCI1.Enabled = True
Me.TxtCI1.BackColor = &H80000005
Me.TxtDirc1.Enabled = True
Me.TxtDirc1.BackColor = &H80000005
Me.TxtObsr1.Enabled = True
Me.TxtObsr1.BackColor = &H80000005
Me.CmbEdad1.Enabled = True
Me.CmbEdad1.BackColor = &H80000005
Me.TxtHist1.Enabled = True
Me.TxtHist1.BackColor = &H80000005
Me.TxtApellido2.Enabled = True
Me.TxtApellido2.BackColor = &H80000005
Me.TxtNombre2.Enabled = True
Me.TxtNombre2.BackColor = &H80000005
Me.TxtSexo2.Enabled = True
Me.TxtSexo2.BackColor = &H80000005
Me.TxtHabt2.Enabled = True
Me.TxtHabt2.BackColor = &H80000005
Me.TxtCI2.Enabled = True
Me.TxtCI2.BackColor = &H80000005
Me.TxtDirc2.Enabled = True
Me.TxtDirc2.BackColor = &H80000005
Me.TxtObsr2.Enabled = True
Me.TxtObsr2.BackColor = &H80000005
Me.CmbEdad2.Enabled = True
Me.CmbEdad2.BackColor = &H80000005
Me.TxtHist2.Enabled = True
Me.TxtHist2.BackColor = &H80000005
Case 3
Me.TxtApellido1.Enabled = True
Me.TxtApellido1.BackColor = &H80000005
Me.TxtNombre1.Enabled = True
Me.TxtNombre1.BackColor = &H80000005
Me.TxtSexo1.Enabled = True
Me.TxtSexo1.BackColor = &H80000005
Me.TxtHabt1.Enabled = True
Me.TxtHabt1.BackColor = &H80000005
Me.TxtCI1.Enabled = True
Me.TxtCI1.BackColor = &H80000005
Me.TxtDirc1.Enabled = True
Me.TxtDirc1.BackColor = &H80000005
Me.TxtObsr1.Enabled = True
Me.TxtObsr1.BackColor = &H80000005
Me.CmbEdad1.Enabled = True
Me.CmbEdad1.BackColor = &H80000005
Me.TxtHist1.Enabled = True
Me.TxtHist1.BackColor = &H80000005
Me.TxtApellido2.Enabled = True
Me.TxtApellido2.BackColor = &H80000005
Me.TxtNombre2.Enabled = True
Me.TxtNombre2.BackColor = &H80000005
Me.TxtSexo2.Enabled = True
Me.TxtSexo2.BackColor = &H80000005
Me.TxtHabt2.Enabled = True
Me.TxtHabt2.BackColor = &H80000005
Me.TxtCI2.Enabled = True
Me.TxtCI2.BackColor = &H80000005
Me.TxtDirc2.Enabled = True
Me.TxtDirc2.BackColor = &H80000005
Me.TxtObsr2.Enabled = True
Me.TxtObsr2.BackColor = &H80000005
Me.CmbEdad2.Enabled = True
Me.CmbEdad2.BackColor = &H80000005
Me.TxtHist2.Enabled = True
Me.TxtHist2.BackColor = &H80000005
Me.TxtApellido3.Enabled = True
Me.TxtApellido3.BackColor = &H80000005
Me.TxtNombre3.Enabled = True
Me.TxtNombre3.BackColor = &H80000005
Me.TxtSexo3.Enabled = True
Me.TxtSexo3.BackColor = &H80000005
Me.TxtHabt3.Enabled = True
Me.TxtHabt3.BackColor = &H80000005
Me.TxtCI3.Enabled = True
Me.TxtCI3.BackColor = &H80000005
Me.TxtDirc3.Enabled = True
Me.TxtDirc3.BackColor = &H80000005
Me.TxtObsr3.Enabled = True
Me.TxtObsr3.BackColor = &H80000005
Me.CmbEdad3.Enabled = True
Me.CmbEdad3.BackColor = &H80000005
Me.TxtHist3.Enabled = True
Me.TxtHist3.BackColor = &H80000005
Case 4
Me.TxtApellido1.Enabled = True
Me.TxtApellido1.BackColor = &H80000005
Me.TxtNombre1.Enabled = True
Me.TxtNombre1.BackColor = &H80000005
Me.TxtSexo1.Enabled = True
Me.TxtSexo1.BackColor = &H80000005
Me.TxtHabt1.Enabled = True
Me.TxtHabt1.BackColor = &H80000005
Me.TxtCI1.Enabled = True
Me.TxtCI1.BackColor = &H80000005
Me.TxtDirc1.Enabled = True
Me.TxtDirc1.BackColor = &H80000005
Me.TxtObsr1.Enabled = True
Me.TxtObsr1.BackColor = &H80000005
Me.CmbEdad1.Enabled = True
Me.CmbEdad1.BackColor = &H80000005
Me.TxtHist1.Enabled = True
Me.TxtHist1.BackColor = &H80000005
Me.TxtApellido2.Enabled = True
Me.TxtApellido2.BackColor = &H80000005
Me.TxtNombre2.Enabled = True
Me.TxtNombre2.BackColor = &H80000005
Me.TxtSexo2.Enabled = True
Me.TxtSexo2.BackColor = &H80000005
Me.TxtHabt2.Enabled = True
Me.TxtHabt2.BackColor = &H80000005
Me.TxtCI2.Enabled = True
Me.TxtCI2.BackColor = &H80000005
Me.TxtDirc2.Enabled = True
Me.TxtDirc2.BackColor = &H80000005
Me.TxtObsr2.Enabled = True
Me.TxtObsr2.BackColor = &H80000005
Me.CmbEdad2.Enabled = True
Me.CmbEdad2.BackColor = &H80000005
Me.TxtHist2.Enabled = True
Me.TxtHist2.BackColor = &H80000005
Me.TxtApellido3.Enabled = True
Me.TxtApellido3.BackColor = &H80000005
Me.TxtNombre3.Enabled = True
Me.TxtNombre3.BackColor = &H80000005
Me.TxtSexo3.Enabled = True
Me.TxtSexo3.BackColor = &H80000005
Me.TxtHabt3.Enabled = True
Me.TxtHabt3.BackColor = &H80000005
Me.TxtCI3.Enabled = True
Me.TxtCI3.BackColor = &H80000005
Me.TxtDirc3.Enabled = True
Me.TxtDirc3.BackColor = &H80000005
Me.TxtObsr3.Enabled = True
Me.TxtObsr3.BackColor = &H80000005
Me.CmbEdad3.Enabled = True
Me.CmbEdad3.BackColor = &H80000005
Me.TxtHist3.Enabled = True
Me.TxtHist3.BackColor = &H80000005
Me.TxtApellido4.Enabled = True
Me.TxtApellido4.BackColor = &H80000005
Me.TxtNombre4.Enabled = True
Me.TxtNombre4.BackColor = &H80000005
Me.TxtSexo4.Enabled = True
Me.TxtSexo4.BackColor = &H80000005
Me.TxtHabt4.Enabled = True
Me.TxtHabt4.BackColor = &H80000005
Me.TxtCI4.Enabled = True
Me.TxtCI4.BackColor = &H80000005
Me.TxtDirc4.Enabled = True
Me.TxtDirc4.BackColor = &H80000005
Me.TxtObsr4.Enabled = True
Me.TxtObsr4.BackColor = &H80000005
Me.CmbEdad4.Enabled = True
Me.CmbEdad4.BackColor = &H80000005
Me.TxtHist4.Enabled = True
Me.TxtHist4.BackColor = &H80000005
............ asi susecivamente hasta llegar al select 8 se pueden imaginar lo largo que es
Valora esta pregunta


0