Ver Mensaje Individual
  #6 (permalink)  
Antiguo 20/12/2011, 22:17
Avatar de catanzaro99
catanzaro99
 
Fecha de Ingreso: diciembre-2011
Ubicación: Moreno Buenos Aires
Mensajes: 21
Antigüedad: 13 años, 2 meses
Puntos: 2
Respuesta: asignar una variable como nombre de un combobox??

Hola amigos nuevamente

Aquí dejo el código y las capturas de pantallas pedidas:

Código vb:
Ver original
  1. Public Class CargarDatosAlumnos
  2.  
  3.     Private Sub CargarDatosAlumnos_Load(ByVal sender As System.Object, _
  4.                                         ByVal e As System.EventArgs) _
  5.                                         Handles MyBase.Load
  6.  
  7.     End Sub
  8.  
  9.    
  10.     Private Sub ComboBox7_SelectedIndexChanged(ByVal sender As System.Object, _
  11.                                                ByVal e As System.EventArgs) _
  12.                                                Handles ComboBox7.SelectedIndexChanged
  13.  
  14.         'aquí iria rutina de ocultamiento que pretendo
  15.        'dim i as Integer = 0
  16.        'for i = 9 to 13 (para ocultar desde el ComboBox9 al ComboBox13 actuales)
  17.        'combobox[i].Visible = False
  18.        'next
  19.  
  20.         'la rutina anterior reemplaza toda la porción de codigo que sigue, a la que
  21.        'le falta agregar otros 10 o 12 ComboBox que con la rutina anterior solo
  22.        'debería modificar el lazo for a 25 (for i = 9 to 25)
  23.        If ComboBox7.SelectedItem <> "Argentina" Then
  24.             ComboBox9.Visible = False
  25.             ComboBox10.Visible = False
  26.             ComboBox11.Visible = False
  27.             ComboBox12.Visible = False
  28.             ComboBox13.Visible = False
  29.             ComboBox10.Visible = False
  30.             ComboBox11.Visible = False
  31.             ComboBox12.Visible = False
  32.             ComboBox13.Visible = False
  33.             'debo seguir agregando ComboBox hasta el ComboBox25 aproximadamente
  34.            Label29.Visible = False
  35.             Label35.Visible = False
  36.             Label30.Visible = False
  37.             Label12.Visible = False
  38.  
  39.         End If
  40.  
  41.         If ComboBox7.SelectedItem = "Argentina" Then
  42.             Label35.Visible = False
  43.             Label37.Visible = False
  44.             ComboBox6.Visible = True 'hace visible el ComboBox que permite seleccionar las provincias Argentinas
  45.            ComboBox6.SelectedIndex = 0
  46.             ComboBox6.Location = New Point(237, 215) 'pone el combobox en la posición de pantalla
  47.            Label11.Visible = True 'hace visible el Label título del ComboBox
  48.            Label11.Location = New Point(297, 199)   'pone el label en la posición de pantalla
  49.            Exit Sub
  50.         Else
  51.             ComboBox6.Visible = False
  52.             Label11.Visible = False
  53.         End If
  54.  
  55.         If ComboBox7.SelectedItem = "Bolivia" Then
  56.             Label37.Visible = True
  57.             Label37.Location = New Point(285, 199)
  58.             TextBox4.Visible = True
  59.             TextBox4.Location = New Point(237, 215)
  60.             Exit Sub
  61.         Else
  62.             Label37.Visible = False
  63.             TextBox4.Visible = False
  64.         End If
  65.  
  66.         If ComboBox7.SelectedItem = "Brasil" Then
  67.             Label37.Visible = True
  68.             Label37.Location = New Point(285, 199)
  69.             TextBox4.Visible = True
  70.             TextBox4.Location = New Point(237, 215)
  71.             Exit Sub
  72.         Else
  73.             Label37.Visible = False
  74.             TextBox4.Visible = False
  75.         End If
  76.  
  77.         If ComboBox7.SelectedItem = "Chile" Then
  78.             Label37.Visible = True
  79.             Label37.Location = New Point(285, 199)
  80.             TextBox4.Visible = True
  81.             TextBox4.Location = New Point(237, 215)
  82.             Exit Sub
  83.         Else
  84.             Label37.Visible = False
  85.             TextBox4.Visible = False
  86.         End If
  87.  
  88.         If ComboBox7.SelectedItem = "Paraguay" Then
  89.             Label37.Visible = True
  90.             Label37.Location = New Point(285, 199)
  91.             TextBox4.Visible = True
  92.             TextBox4.Location = New Point(237, 215)
  93.             Exit Sub
  94.         Else
  95.             Label37.Visible = False
  96.             TextBox4.Visible = False
  97.         End If
  98.  
  99.         If ComboBox7.SelectedItem = "Uruguay" Then
  100.             Label37.Visible = True
  101.             Label37.Location = New Point(285, 199)
  102.             TextBox4.Visible = True
  103.             TextBox4.Location = New Point(237, 215)
  104.             Exit Sub
  105.         Else
  106.             Label37.Visible = False
  107.             TextBox4.Visible = False
  108.         End If
  109.  
  110.         If ComboBox7.SelectedItem = "Otro País -indicar-" Then
  111.             TextBox4.Visible = True
  112.             TextBox4.Location = New Point(237, 215)
  113.             Label12.Visible = True
  114.             Label12.Location = New Point(252, 199)
  115.             Exit Sub
  116.         Else
  117.             TextBox4.Visible = False
  118.             Label12.Visible = False
  119.         End If
  120.  
  121.        
  122.  
  123.     End Sub
  124.  
  125.     Private Sub ComboBox6_SelectedIndexChanged(ByVal sender As System.Object, _
  126.                                                ByVal e As System.EventArgs) _
  127.                                                Handles ComboBox6.SelectedIndexChanged
  128.  
  129.         If ComboBox6.SelectedItem = "Buenos Aires" Then
  130.             ComboBox9.SelectedIndex = 0
  131.             ComboBox9.Visible = True
  132.             ComboBox9.Location = New Point(470, 216)
  133.             Label29.Visible = True
  134.             Label29.Location = New Point(490, 199)
  135.             Exit Sub
  136.         Else
  137.             ComboBox9.Visible = False
  138.             Label29.Visible = False
  139.         End If
  140.  
  141.         If ComboBox6.SelectedItem = "Ciudad Autónoma de Buenos Aires" Then
  142.             Label35.Visible = False
  143.             Label29.Visible = False
  144.             ComboBox10.SelectedIndex = 0
  145.             ComboBox10.Visible = True
  146.             ComboBox10.Location = New Point(470, 215)
  147.             Label30.Visible = True
  148.             Label30.Location = New Point(490, 199)
  149.             Exit Sub
  150.         Else
  151.             ComboBox10.Visible = False
  152.             Label30.Visible = False
  153.         End If
  154.  
  155.         If ComboBox6.SelectedItem = "Catamarca" Then
  156.             ComboBox11.SelectedIndex = 0
  157.             ComboBox11.Visible = True
  158.             ComboBox11.Location = New Point(470, 215)
  159.             Label35.Visible = True
  160.             Label35.Location = New Point(530, 199)
  161.             Exit Sub
  162.         Else
  163.             ComboBox11.Visible = False
  164.             Label30.Visible = False
  165.         End If
  166.  
  167.         If ComboBox6.SelectedItem = "Chaco" Then
  168.             ComboBox12.SelectedIndex = 0
  169.             ComboBox12.Visible = True
  170.             ComboBox12.Location = New Point(470, 215)
  171.             Label35.Visible = True
  172.             Label35.Location = New Point(530, 199)
  173.             Exit Sub
  174.         Else
  175.             ComboBox12.Visible = False
  176.             Label35.Visible = False
  177.         End If
  178.  
  179.         If ComboBox6.SelectedItem = "Corrientes" Then
  180.             ComboBox13.SelectedIndex = 0
  181.             ComboBox13.Visible = True
  182.             ComboBox13.Location = New Point(470, 215)
  183.             Label35.Visible = True
  184.             Label35.Location = New Point(530, 199)
  185.             Exit Sub
  186.         Else
  187.             ComboBox13.Visible = False
  188.             Label35.Visible = False
  189.         End If
  190.  
  191.         If ComboBox6.SelectedItem = "Entre Rios" Then
  192.             ComboBox14.SelectedIndex = 0
  193.             ComboBox14.Visible = True
  194.             ComboBox14.Location = New Point(470, 215)
  195.             Label35.Visible = True
  196.             Label35.Location = New Point(530, 199)
  197.             Exit Sub
  198.         Else
  199.             ComboBox14.Visible = False
  200.             Label35.Visible = False
  201.         End If
  202.  
  203.         If ComboBox6.SelectedItem = "Chubut" Then
  204.             ComboBox15.SelectedIndex = 0
  205.             ComboBox15.Visible = True
  206.             ComboBox15.Location = New Point(470, 215)
  207.             Label35.Visible = True
  208.             Label35.Location = New Point(530, 199)
  209.             Exit Sub
  210.         Else
  211.             ComboBox15.Visible = False
  212.             Label35.Visible = False
  213.         End If
  214.  
  215.     End Sub
  216.  
  217. End Class

Mañana subiré las capturas de pantalla, que no puedo hacerlo hoy por falta de tiempo...

Hasta mañana y gracias por la ayuda...