Foros del Web » Programación para mayores de 30 ;) » Programación General » Visual Basic clásico »

Duda con for

Estas en el tema de Duda con for en el foro de Visual Basic clásico en Foros del Web. HOla, estoy haciendo un bucle y no me funciona esto: Código: For i = 0 To 12 Step 1 Textf(i).Text = Textf(1).Text Next Es para ...
  #1 (permalink)  
Antiguo 13/12/2008, 05:51
 
Fecha de Ingreso: septiembre-2007
Mensajes: 189
Antigüedad: 16 años, 7 meses
Puntos: 1
Duda con for

HOla, estoy haciendo un bucle y no me funciona esto:
Código:
For i = 0 To 12 Step 1
Textf(i).Text = Textf(1).Text
Next
Es para ahorar lineas y no poner:
Textf(1).Text = Textf(1).Text
Textf(2).Text = Textf(1).Text
Textf(3).Text = Textf(1).Text
Textf(4).Text = Textf(1).Text
Textf(5).Text = Textf(1).Text
..........
Y no me funciona Me dice: "El elemento 0 del matriz de controles no existe" y se colorea la linea 2, o sea:
Textf(i).Text = Textf(1).Text
Saludos y gracias de antemano!
  #2 (permalink)  
Antiguo 13/12/2008, 08:30
 
Fecha de Ingreso: abril-2008
Mensajes: 281
Antigüedad: 16 años
Puntos: 1
Respuesta: Duda con for

Cita:
Iniciado por magTpeak Ver Mensaje
HOla, estoy haciendo un bucle y no me funciona esto:
Código:
For i = 0 To 12 Step 1
Textf(i).Text = Textf(1).Text
Next
Es para ahorar lineas y no poner:
Textf(1).Text = Textf(1).Text
Textf(2).Text = Textf(1).Text
Textf(3).Text = Textf(1).Text
Textf(4).Text = Textf(1).Text
Textf(5).Text = Textf(1).Text
..........
Y no me funciona Me dice: "El elemento 0 del matriz de controles no existe" y se colorea la linea 2, o sea:
Textf(i).Text = Textf(1).Text
Saludos y gracias de antemano!

Que tal, mira segun yo ahi el problema es q tus texbox empiezan con el 1 y el for lo estas empezando desde cero tendria que ser de esta manera

Código:
For i = 1 To 12 Step 1
Textf(i).Text = Textf(1).Text
Next
  #3 (permalink)  
Antiguo 13/12/2008, 11:12
 
Fecha de Ingreso: septiembre-2007
Mensajes: 189
Antigüedad: 16 años, 7 meses
Puntos: 1
Respuesta: Duda con for

Gracias
  #4 (permalink)  
Antiguo 13/12/2008, 11:25
 
Fecha de Ingreso: septiembre-2007
Mensajes: 189
Antigüedad: 16 años, 7 meses
Puntos: 1
Respuesta: Duda con for

otra pregunta :D
Código:
Private Sub applyallf_Click(Index As Integer)
applyallf es un matriz de controles, como puedo saver desde q boton exactamente se ha pulsado?
Si lo pongo asi me da error
Código:
Private Sub applyallf(2)_Click(Index As Integer)
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 04:52.