P. 1
CALCULADORA SENCILLA

CALCULADORA SENCILLA

|Views: 260|Likes:
Este proyecto fue realizado por Miguel Núñez de Venezuela, se le hicieron algunos cambios solo con fines academicos
Este proyecto fue realizado por Miguel Núñez de Venezuela, se le hicieron algunos cambios solo con fines academicos

More info:

Published by: Hernando Delgado Villegas on Aug 12, 2011
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

12/23/2013

pdf

text

original

CALCULADORA SENCILLA

Figura 1.1 Calculadora Control Frm Frame1 Frame2 Frame3 Frame4 Label1 Command Propiedad Name Caption Name Caption Name Caption name Caption Name Caption Name Caption Name Caption Index Style BackColor Command Name Caption Index Style BackColor Valor Form1 calculadora Frame1 Frame2 Frame3 Frame4 Command LblDisplay 0.1234567890 CmdMemory MR, MC, M-, M+ 0, 1, 2, 3 Graphical &H00FFC0C0& CmdNumber 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 Graphical &H00FFC0C0& Control Command Propiedad Name Caption Style BackColor Name Caption Index Style BackColor Name Caption Style BackColor Name Caption Style BackColor Name Caption Style BackColor Command Name Caption Valor CmdEqualTo = Graphical &H00FFC0C0& CmdOperator +, -, X, / 0, 1, 2, 3 Graphical &H00FFC0C0& Command1 Back Graphical &H00FFC0C0& CmdCE CE Graphical &H00FFC0C0& CmdSqrt Raiz2 Graphical &H00FFC0C0& CmdPlusOrMinus +/-

Command

Command

Cammand

Command

Name CmdDot Style Graphical Caption . BackColor &H00FFC0C0& Style Graphical Timer1 Name Timer1 BackColor &H00FFC0C0& Interval 300 Tabla 1.1 Objetos y propiedades del Ejercicio Calculadora

'Calculadora sencilla. 'Desarrollado por Hernando Delgado V. 'Correo: herdel_itipam2008@hotmail.com Option Explicit Dim strPreviousValue As String Dim strOperator As String Dim blnDot As Boolean Dim strMemory As String Dim blnDisplay As Boolean Dim strAuthor As String Private Sub Command1_Click() If Len(lblDisplay) > 0 Then lblDisplay = Mid$(lblDisplay, 1, Len(lblDisplay) - 1) Else Beep End If End Sub Private Sub Form_Load() lblDisplay.Caption = "0" strPreviousValue = "" strMemory = "0" strOperator = "" blnDot = False blnDisplay = True strAuthor = " Author:Hernando Delgado... (Cali, Valle del Cauca," + _ "Colombia) Email: herdel_itipam2008@hotmail.com Fecha de Creación:Agos. 11, 2010 -" End Sub Private Sub cmdNumber_Click(Index As Integer) If blnDisplay = True Then If blnDot = False And lblDisplay.Caption = "0" Then lblDisplay.Caption = "" End If lblDisplay.Caption = lblDisplay.Caption + cmdNumber(Index).Caption Else strPreviousValue = lblDisplay.Caption lblDisplay.Caption = cmdNumber(Index).Caption blnDisplay = True End If End Sub Private Sub cmdDot_Click() If blnDisplay = True Then

If blnDot = False Then blnDot = True lblDisplay.Caption = lblDisplay.Caption + "." End If Exit Sub End If If blnDisplay = False And blnDot = False Then lblDisplay.Caption = "0." blnDisplay = True blnDot = True End If End Sub Private Sub cmdCE_Click() If Timer1.Enabled = True Then Timer1.Enabled = False blnDot = False lblDisplay.Caption = "0" strOperator = "" strPreviousValue = "0" End Sub Private Sub cmdOperator_Click(Index As Integer) blnDot = False blnDisplay = False If Len(strOperator) = 1 Then Call math strOperator = cmdOperator(Index).Caption Else strOperator = cmdOperator(Index).Caption strPreviousValue = lblDisplay.Caption End If End Sub Private Function math() On Error GoTo errorHandler Select Case strOperator Case "+" lblDisplay.Caption = Val(lblDisplay.Caption) + Val(strPreviousValue) Case "-" lblDisplay.Caption = Val(strPreviousValue) - Val(lblDisplay.Caption) Case "x" lblDisplay.Caption = Val(lblDisplay.Caption) * Val(strPreviousValue) Case "/" lblDisplay.Caption = Val(strPreviousValue) / Val(lblDisplay.Caption) End Select Exit Function errorHandler: lblDisplay.Caption = "Error " strOperator = "" strPreviousValue = "0" blnDot = False

blnDisplay = False End Function Private Sub cmdIsEqualTo_Click() Call math strOperator = "" If Len(lblDisplay.Caption) <= 19 Then lblDisplay.FontSize = 15 Else lblDisplay.FontSize = 10 End If End Sub Private Sub cmdPlusOrMinus_Click() lblDisplay.Caption = Val(lblDisplay.Caption) - (Val(lblDisplay.Caption) + Val(lblDisplay.Caption)) End Sub Private Sub cmdSqrt_Click() lblDisplay.Caption = Sqr(Val(lblDisplay.Caption)) End Sub Private Sub cmdMemory_Click(Index As Integer) If Timer1.Enabled = False Then Select Case cmdMemory(Index).Caption Case "M+" strMemory = Val(strMemory) + Val(lblDisplay.Caption) Case "M-" strMemory = Val(strMemory) - Val(lblDisplay.Caption) Case "MR" lblDisplay.Caption = strMemory blnDisplay = False Case "MC" strMemory = "0" lblDisplay.Caption = "0" End Select End If End Sub Private Sub Timer1_Timer() strAuthor = Mid$(strAuthor, 2, Len(strAuthor) - 1) + Left(strAuthor, 1) lblDisplay.Caption = Left(strAuthor, 18) Form1.Width = 4095 Form1.Height = 3960 End Sub

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->