viernes, 14 de noviembre de 2008

Codigo para realizar una tabla de multiplicar


Dim resultado As Double
Dim num, lim As Double

Private Sub Botonborrar_Click()
Limite.Text = " "
Numero.Text = " "
Tabla.Clear
num = 0
lim = 0
Numero.SetFocus
End Sub

Private Sub Botoncalcular_Click()

If Numero.Text = " " Then
MsgBox "Debe digitar un numero", 32, "Error"
Numero.SetFocus
Else
For cont = 1 To lim
resultado = num * cont
Tabla.AddItem " " & num & " x " & cont & " = " & resultado
Next
End If
End Sub

Private Sub Botonsalir_Click()
End
End Sub

Private Sub Form_Load()
Numero.Text = " "
End Sub


Private Sub Limite_Change()
If Numero.Text <> " " Then
lim = Limite.Text
End If
End Sub

Private Sub Limite_KeyPress(KeyAscii As Integer)
If KeyAscii <> 57 Then
KeyAscii = 0
End If
End Sub

Private Sub Numero_Change()
If Numero.Text <> " " Then
num = Numero.Text
End If
End Sub

Private Sub Numero_KeyPress(KeyAscii As Integer)
If KeyAscii <> 57 Then
KeyAscii = 0
End If
End Sub

1 comentario:

Unknown dijo...

GRACIAS
PERO PODIAS EXPLICAR PARA QUE SIRVE CADA COSA