martes, 12 de febrero de 2008

Calculadora en Visual Basic


Aquí os dejo un programita hecho por mi en Visual Basic.
Es una calculadora bastante sencilla, que para los que quieran aprender Visual Basic les vendra bien.

Os adjunto el codigo fuente para el que quiera probarlo y modificarlo:

----------Calculadora-----------------
Private Sub Command1_Click()
res.Text = Val(num1.Text) + Val(num2.Text)
oper.Text = Val(oper.Text) + 1
End Sub

Private Sub Command2_Click()
res.Text = Val(num1.Text) - Val(num2.Text)
oper.Text = Val(oper.Text) + 1
End Sub

Private Sub Command3_Click()
res.Text = Val(num1.Text) * Val(num2.Text)
oper.Text = Val(oper.Text) + 1
End Sub

Private Sub Command4_Click()
If Val(num2.Text) > 0 Then
res.Text = Val(num1.Text) / Val(num2.Text)
oper.Text = Val(oper.Text) + 1
End If
End Sub

Private Sub Command5_Click()
Close
End Sub

Private Sub Timer1_Timer()
hora.Caption = Time
fecha.Caption = Date
End Sub
------------------------------------

Aquí el link para bajarla:

Calculadora v.1.1


Me gustaria que si alguien hace modificaciones me dejara algún comentario y posteara el codigo y así aprenderemos todos.

Un saludo!!

No hay comentarios: