Visual Basic - urgente for contador

Life is soft - evento anual de software empresarial
 
Vista:

urgente for contador

Publicado por lucy (8 intervenciones) el 24/09/2004 19:07:59
necesito muchisima ayuda, tengo 3 textbox, uno de valor inicial otro de valor final y otro donde me va a incrementar. has de cuenta en el primer textbox le ingreso un numero, en el segundo textbox le ingreso otro numero y en el tercer textbox le voy a poner el numero de veces que quiero que me incremente. es un contador. y esas tres cantidades me las tiene que pasar a una list. pero cuando ingreso cantidad no agrega las cantidads a la lista ayudenme por favor
yo le puse este codigo
Private Sub CmdAplicar_Click()
Dim resp As Integer
For resp = Text1.Text To Text2.Text Step Text3.Text
resp = List1.AddItem
Next
End Sub
y en cada texto le puse este codigo
Private Sub Text1_Change()
If Text1.Text <> Empty Then
If IsNumeric(Text1.Text) = False Then
MsgBox \"numeros\", vbCritical, \"Error\"
Text1.Text = 0
End If
End If
End Sub
Private Sub Text2_Change()
If Text2.Text <> Empty Then
If IsNumeric(Text2.Text) = False Then
MsgBox \"numeros\", vbCritical, \"error\"
Text2.Text = 0
End If
End If
End Sub
Private Sub Text3_Change()
If Text3.Text <> Empty Then
If IsNumeric(Text3.Text) = False Then
MsgBox \"numeros\", vbCritical, \"error\"
Text3.Text = 1
End If
End If
End Sub
ayudenme gracias.
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:urgente for contador

Publicado por fernando (79 intervenciones) el 24/09/2004 19:53:01
Mira, no se si entendí bien, pero ahi en la linea q pusiste
"resp = list1.additem"
no debe ser "list1.additem resp"?
es decir, al additem le pasas como parametro el valor q querés agregarle a la lista....
no se si esa era tu pregunta.
suerte
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:urgente for contador

Publicado por lucy (8 intervenciones) el 24/09/2004 20:09:16
"resp = list1.additem"
me marca error de sintaxis
ayudame por favor es un programa que tengo que entregar hoy
te lo agradezco muchisimo
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:urgente for contador...Ok!!!

Publicado por miguel (1042 intervenciones) el 24/09/2004 21:17:27
Siguiendo tu ejemplo te quedaría:
Private Sub CmdAplicar_Click()
Dim resp As Integer
For resp = Text1.Text To Text2.Text Step Text3.Text
List1.AddItem CStr(resp) 'Aquí tendrias que cambiarle
Next
End Sub
Private Sub Text1_Change()
If Text1.Text <> Empty Then
If IsNumeric(Text1.Text) = False Then
MsgBox "numeros", vbCritical, "Error\"
Text1.Text = 0
End If
End If
End Sub
Private Sub Text2_Change()
If Text2.Text <> Empty Then
If IsNumeric(Text2.Text) = False Then
MsgBox "numeros\", vbCritical, "error\"
Text2.Text = 0
End If
End If
End Sub
Private Sub Text3_Change()
If Text3.Text <> Empty Then
If IsNumeric(Text3.Text) = False Then
MsgBox "numeros\", vbCritical, "error\"
Text3.Text = 1
End If
End If
End Sub
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar