Calculadora

Páginas: 2 (276 palabras) Publicado: 28 de junio de 2011
Dim valor, signo As String
Dim n1, n2, res As Double
Private Sub Command1_Click()
signo = "/" 'guarda el signo
n1 = Val(valor) ' convierte la cadena a #
Text1.Text = "" ' limpia eltexto
valor = ""
Text1.SetFocus
End Sub

Private Sub Command10_Click()
signo = "-"
n1 = Val(valor)
Text1.Text = ""
valor = ""
End Sub

Private Sub Command11_Click()
valor = valor & "9"Text1.Text = valor
End Sub

Private Sub Command12_Click()
valor = valor & "6"
Text1.Text = valor
End Sub

Private Sub Command13_Click()
valor = valor & "3"
Text1.Text = valor
End SubPrivate Sub Command14_Click()
valor = valor & "."
Text1.Text = valor
End Sub

Private Sub Command16_Click()
n2 = Val(valor)
If signo = "/" Then
res = n1 / n2
Text1.Text = res
End Ifn2 = Val(valor)
If signo = "*" Then
res = n1 * n2
Text1.Text = res
End If
n2 = Val(valor)
If signo = "-" Then
res = n1 - n2
Text1.Text = res
End If
n2 = Val(valor)
If signo = "+" Thenres = n1 + n2
Text1.Text = res
End If
End Sub

Private Sub Command17_Click()
signo = "+"
n1 = Val(valor)
Text1.Text = ""
valor = ""
End Sub

Private Sub Command18_Click()

End SubPrivate Sub Command2_Click()
valor = valor & "7"
Text1.Text = valor
End Sub

Private Sub Command3_Click()
valor = valor & "4"
Text1.Text = valor
End Sub

Private Sub Command4_Click()valor = valor & "1"
Text1.Text = valor
End Sub

Private Sub Command5_Click()
valor = valor & "0"
Text1.Text = valor
End Sub

Private Sub Command6_Click()
signo = "*" ' guarda el signo
n1= Val(valor) ' convierte la cadena a #
Text1.Text = ""
valor = ""
End Sub

Private Sub Command7_Click()
valor = valor & "8"
Text1.Text = valor
End Sub

Private Sub Command8_Click()valor = valor & "5"
Text1.Text = valor
End Sub

Private Sub Command9_Click()
valor = valor & "2"
Text1.Text = valor
End Sub

Bibliografia: trabajo que hice en la sala de computo de mi escuela
Leer documento completo

Regístrate para leer el documento completo.

Estos documentos también te pueden resultar útiles

  • Calculo
  • Calculo
  • Calculos
  • Calculo
  • Calculo
  • Calculo
  • Calculo
  • Calculo

Conviértase en miembro formal de Buenas Tareas

INSCRÍBETE - ES GRATIS