repetir una accion
ola m gustaria hacer un poryecto en el q ay un textbox y
un comand
lo q quiero es q al dar al boton este sea presionado
(realize su funcion) tamtas veces como el numero q
previamnete s pondra en el texbox
es posible???
un comand
lo q quiero es q al dar al boton este sea presionado
(realize su funcion) tamtas veces como el numero q
previamnete s pondra en el texbox
es posible???
Sería usando el evento click del botón y un bucle que se repita tantas veces como ponga el textbox; tendrías que comprobar q el dato del textbox es numérico
Podría ser algo así, siendo Button1 el botón y TextBox1 el texto
Private Sub Button1_Click()
dim intCont1 As Integer
if not IsNumeric(TextBox1.Text) then
TextBox1.Text = 1
end if
for intCont1 = 1 to CInt(TextBox1.Text)
' si el número es 0 o negativo, nunca se ejecutaría
FuncionQueQuieresEjecutar
next intCont1
End Sub
Podría ser algo así, siendo Button1 el botón y TextBox1 el texto
Private Sub Button1_Click()
dim intCont1 As Integer
if not IsNumeric(TextBox1.Text) then
TextBox1.Text = 1
end if
for intCont1 = 1 to CInt(TextBox1.Text)
' si el número es 0 o negativo, nunca se ejecutaría
FuncionQueQuieresEjecutar
next intCont1
End Sub
