Calculadora en Visual Basic 6.0
Dim num1 As Double
Dim num2 As Double
Dim signo As String
Private Sub Borrar_Click()
Text1.Text = ""
End Sub
Private Sub Sumar_Click()
signo = "+"
num1 = Text1.Text
Text1.Text = ""
End Sub
Private Sub Restar_Click()
signo = "-"
num1 = Text1.Text
Text1.Text = ""
End Sub
Private Sub Multiplicar_Click()
signo = "X"
num1 = Text1.Text
Text1.Text = ""
End Sub
Private Sub Dividir_Click()
signo = "/"
num1 = Text1.Text
Text1.Text = ""
End Sub
Private Sub Igual_Click()
num2 = Text1.Text
If signo = "+" Then
Text1.Text = num1 + num2
End If
If signo = "-" Then
Text1.Text = num1 - num2
End If
If signo = "X" Then
Text1.Text = num1 * num2
End If
If signo = "/" Then
If num2 = 0 Then
MsgBox "Error"
Text1.Text = ""
Else
Text1.Text = num1 / num2
End If
End If
If signo = "^" Then
Text1.Text = num1 ^ num2
End If
End Sub
Private Sub SQR_Click()
num1 = Text1.Text
Text1.Text = Sqr(num1)
End Sub
Private Sub Porcentaje_Click()
num2 = Text1.Text
Text1.Text = (num1 * num2) / 100
End Sub
Private Sub Potencia_Click()
signo = "^"
num1 = Text1.Text
Text1.Text = ""
End Sub
Private Sub Command1_Click(Index As Integer)
Text1.Text = Text1.Text + Command1(Index).Caption
End Sub
Donde puedo descargar visual basic?????
ResponderEliminar