Sie sind auf Seite 1von 8

Calculadora Cientifica Rivera & G 2013

Hecho :Santos Rivera

Imports System.Math Imports Microsoft.VisualBasic.Strings Public Class FrmCalc 'Hecho : Santos Rivera Lujan 'Para : Keleny Dim x As Double, y As Double, z As String, M As Double, done As Boolean '********** Nmeros 1-9 ********** Private Sub Btn1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btn1.Click numtst(1) End Sub Private Sub btn2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn2.Click numtst(2) End Sub Private Sub Btn3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btn3.Click numtst(3) End Sub Private Sub Btn4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btn4.Click numtst(4) End Sub Private Sub Btn5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btn5.Click numtst(5) End Sub Private Sub Btn6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btn6.Click numtst(6) End Sub

Calculadora Cientifica Rivera & G 2013

Hecho :Santos Rivera

Private Sub Btn7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btn7.Click numtst(7) End Sub Private Sub Btn8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btn8.Click numtst(8) End Sub Private Sub Btn9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btn9.Click numtst(9) End Sub '********** Nmeros (Teclas especiales) ********** Private Sub btn0_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn0.Click With txtLcd If done = True Then done = False .Text = "" End If If Not .Text = "0" Then .Text = .Text & "0" End With End Sub Private Sub Btndot_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btndot.Click With txtLcd If done = True Then .Text = "0" done = False If Not (.Text.Contains(".")) Then .Text = .Text & "." End With End Sub Private Sub BtnNeg_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnNeg.Click Dim fixup As String With txtLcd If .Text.Contains("E") Then fixup = .Text.Substring(InStr(.Text, "E")) .Text = .Text.Substring(0, InStr(.Text, "E")) If fixup = "" Then fixup = "0" If fixup = "0" Then Exit Sub If fixup.Contains("-") Then fixup = fixup.Substring(1) Else fixup = "-" & fixup .Text = .Text & fixup Exit Sub End If If .Text = "0" Then Exit Sub If .Text.Contains("-") Then .Text = .Text.Substring(1) Else .Text = "-" & .Text End With End Sub Private Sub BtnRnd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnRnd.Click done = True : txtLcd.Text = Rnd() End Sub Private Sub BtnExp_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnExp.Click With txtLcd

Calculadora Cientifica Rivera & G 2013

Hecho :Santos Rivera

If .Text = "0" Or .Text = "0." Or .Text = "-0." Then Exit Sub If done = True Then .Text = "1" done = False If Not (.Text.Contains("E")) Then .Text = .Text & "E" : z = "E" End With End Sub Private Sub BtnPercent_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnPercent.Click txtLcd.Text = Str(Val(txtLcd.Text) / 100) : done = True End Sub '********** Eliminacin ********** Private Sub BtnC_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnC.Click x = 0 : y = 0 : z = "" : txtLcd.Text = "0" : done = False End Sub Private Sub BtnCE_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnCE.Click If done = False Then txtLcd.Text = txtLcd.Text.Substring(0, Len(txtLcd.Text) - 1) Else txtLcd.Text = "0" done = False End If If txtLcd.Text = "" Or txtLcd.Text = "-" Then txtLcd.Text = "0" End Sub '********** Memoria ********** Private Sub BtnClr_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnClr.Click M = 0 lblM.Visible = False End Sub Private Sub BtnSto_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnSto.Click M = Val(txtLcd.Text) If M = 0 Then lblM.Visible = False Else lblM.Visible = True End Sub Private Sub BtnRet_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnRet.Click If M <> 0 Then txtLcd.Text = Str(M) End Sub Private Sub BtnMAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnMAdd.Click M = M + Val(txtLcd.Text) If M = 0 Then lblM.Visible = False Else lblM.Visible = True End Sub Private Sub BtnMMinus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnMMinus.Click M = M - Val(txtLcd.Text) If M = 0 Then lblM.Visible = False Else lblM.Visible = True End Sub '********** Botones de operaciones ********** Private Sub BtnDo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnDo.Click doit() End Sub

Calculadora Cientifica Rivera & G 2013

Hecho :Santos Rivera

'***** Normales ***** Private Sub BtnAdd_Click(ByVal sender As System.Object, ByVal e System.EventArgs) Handles BtnAdd.Click doit() z = "+" End Sub Private Sub BtnMinus_Click(ByVal sender As System.Object, ByVal System.EventArgs) Handles BtnMinus.Click doit() z = "-" End Sub Private Sub BtnPow_Click(ByVal sender As System.Object, ByVal e System.EventArgs) Handles BtnPow.Click doit() z = "*" End Sub Private Sub BtnDiv_Click(ByVal sender As System.Object, ByVal e System.EventArgs) Handles BtnDiv.Click doit() z = "/" End Sub '***** Potencias y races Private Sub BtnPot_Click(ByVal sender As System.Object, ByVal e System.EventArgs) Handles BtnPot.Click doit() z = "^" End Sub Private Sub BtnRot_Click(ByVal sender As System.Object, ByVal e System.EventArgs) Handles BtnRot.Click txtLcd.Text = Str(Val(txtLcd.Text) ^ 0.5) : done = True End Sub Private Sub BtnPw2_Click(ByVal sender As System.Object, ByVal e System.EventArgs) Handles BtnPw2.Click txtLcd.Text = Str(Val(txtLcd.Text) ^ 2) : done = True End Sub Private Sub BtnPowN1_Click(ByVal sender As System.Object, ByVal System.EventArgs) Handles BtnPowN1.Click txtLcd.Text = Str(Val(txtLcd.Text) ^ (-1)) : done = True End Sub Private Sub BtnXRotY_Click(ByVal sender As System.Object, ByVal System.EventArgs) Handles BtnXRotY.Click doit() z = "XRY" End Sub '***** Trigonometra ***** Private Sub BtnSin_Click(ByVal sender As System.Object, ByVal e System.EventArgs) Handles BtnSin.Click y = Val(txtLcd.Text) If RbtRad.Checked = True Then txtLcd.Text = Str(Sin(y)) Else txtLcd.Text = Str(Sin(y / (180 / PI))) End If done = True End Sub Private Sub BtnCos_Click(ByVal sender As System.Object, ByVal e System.EventArgs) Handles BtnCos.Click y = Val(txtLcd.Text)

As

e As

As

As

As

As

As

e As

e As

As

As

Calculadora Cientifica Rivera & G 2013

Hecho :Santos Rivera

If RbtRad.Checked = True Then txtLcd.Text = Str(Cos(y)) Else txtLcd.Text = Str(Cos(y / (180 / PI))) End If done = True End Sub Private Sub BtnTan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnTan.Click y = Val(txtLcd.Text) If RbtRad.Checked = True Then txtLcd.Text = Str(Tan(y)) Else txtLcd.Text = Str(Tan(y / (180 / PI))) End If done = True End Sub Private Sub RbtDeg_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RbtDeg.CheckedChanged If ChkTo.Checked = True Then ChkTo.Checked = False txtLcd.Text = Val(txtLcd.Text) / (180 / PI) done = True End If End Sub Private Sub RbtRad_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RbtRad.CheckedChanged If ChkTo.Checked = True Then ChkTo.Checked = False txtLcd.Text = Val(txtLcd.Text) * (180 / PI) done = True End If End Sub '***** Constantes ***** Private Sub BtnPi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnPi.Click done = True : txtLcd.Text = PI End Sub Private Sub BtneM_Click(ByVal sender As System.Object, ByVal en As System.EventArgs) Handles BtneM.Click done = True : txtLcd.Text = Str(E) End Sub '***** Otras ***** Private Sub Btn1X_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btn1X.Click y = Val(txtLcd.Text) If y <> 0 Then txtLcd.Text = Str(1 / y) Else txtLcd.Text = "Error" done = True End Sub Private Sub BtnFact_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnFact.Click With txtLcd Dim j As Integer, t As Integer y = Val(.Text) If y < 0 Then .Text = "Error" If y = 0 Then .Text = "1" t = y For j = 1 To t - 1

Calculadora Cientifica Rivera & G 2013

Hecho :Santos Rivera

y = y * j Next .Text = Str(y) End With done = True End Sub Private Sub BtnLog_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnLog.Click If Val(txtLcd.Text) > 0 Then txtLcd.Text = Str(Log10(Val(txtLcd.Text))) done = True End Sub Private Sub BtnLn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnLn.Click If Val(txtLcd.Text) > 0 Then txtLcd.Text = Str(Log(Val(txtLcd.Text))) done = True End Sub '********** Sub Rutinas ********* Sub doit() With txtLcd y = Val(.Text) Select Case z Case "+" : .Text = Str(x + y) Case "-" : .Text = Str(x - y) Case "*" : .Text = Str(x * y) Case "/" : If y <> 0 Then .Text = Str(x / y) Else .Text = "Error" Case "^" : .Text = Str(x ^ y) Case "E" .Text = Val(.Text.Substring(0, InStr(.Text, "E") - 1)) * (10 ^ Val(.Text.Substring(InStr(.Text, "E")))) Case "XRY" : .Text = Str(y ^ (1 / x)) End Select x = Val(txtLcd.Text) : y = 0 : z = "" done = True End With End Sub Sub numtst(ByVal a As Byte) With txtLcd If .Text = "0" Or done = True Then .Text = "" done = False End If .Text = .Text & Str(a).Substring(1) End With End Sub

End Class

Mis Paginas Web :

Calculadora Cientifica Rivera & G 2013

Hecho :Santos Rivera

Mi web Principal" Rivera & G ": Descarga la biblia de java y manual de windows 8. http://riverasn.p.ht/ Mi web Company.Rivera&G : Descarga mis Aplicaciones y Proyectos en visual basic 2012 ,java,C#,PHP,HTML,JavaScript http://santosrl.p.ht/ Mi web "El Hacker 2013": Descarga el manual de visual basic 2010 y visual basic 6.0 portable a full http://riverayg.zz.mu/ Mi facebook: https://www.facebook.com/PatrickNilsdeAlesandro.RiveraLujan Mi grupo de programadores : https://www.facebook.com/groups/398604720248657/ Mi grupo de soporte tecnico PC : https://www.facebook.com/groups/145173492332702/ Mi web JIMBO: http://riverasn.jimdo.com/ Mi twitter.com: https://twitter.com/RIVERALUJANSANT

Calculadora Cientifica Rivera & G 2013

Hecho :Santos Rivera

Das könnte Ihnen auch gefallen