calculadora cientifica en visual basic

Publicado en por Angie te quiere...millosss

 

 

Public

 

Class Form1

 

Dim n1, n2, y As Double

 

Dim opera As Integer

 

Dim respu As Double

 

 

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

n1 = Val(TextBox1.Text)

opera = 3

TextBox1.Text =

" "

 

End Sub

 

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

n1 = Val(TextBox1.Text)

opera = 4

TextBox1.Text =

" "

 

End Sub

 

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click

n1 = Val(TextBox1.Text)

opera = 1

TextBox1.Text =

" "

 

End Sub

 

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click

n1 = Val(TextBox1.Text)

opera = 2

TextBox1.Text =

" "

 

End Sub

 

Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click

TextBox1.Text = TextBox1.Text + Str(1)

 

End Sub

 

Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click

TextBox1.Text = TextBox1.Text + Str(2)

 

End Sub

 

Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click

TextBox1.Text = TextBox1.Text + Str(3)

 

End Sub

 

Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click

TextBox1.Text = TextBox1.Text + Str(4)

 

End Sub

 

Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click

TextBox1.Text = TextBox1.Text + Str(5)

 

End Sub

 

Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button10.Click

TextBox1.Text = TextBox1.Text + Str(6)

 

End Sub

 

Private Sub Button11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button11.Click

TextBox1.Text = TextBox1.Text + Str(7)

 

End Sub

 

Private Sub Button12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button12.Click

TextBox1.Text = TextBox1.Text + Str(8)

 

End Sub

 

Private Sub Button13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button13.Click

TextBox1.Text = TextBox1.Text + Str(9)

 

End Sub

 

Private Sub Button14_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button14.Click

TextBox1.Text = TextBox1.Text + Str(0)

 

End Sub

 

Private Sub Button17_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button17.Click

TextBox1.Text = (

" ")

 

End Sub

 

Private Sub Button16_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button16.Click

 

End

 

End Sub

 

Private Sub Button15_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button15.Click

respu = 0

n2 = Val(TextBox1.Text)

 

If (opera = 1) Then

respu = n1 * n2

TextBox1.Text = respu

 

End If

 

If (opera = 2) Then

respu = n1 / n2

TextBox1.Text = respu

 

End If

 

If (opera = 3) Then

respu = n1 + n2

TextBox1.Text = respu

 

End If

 

If (opera = 4) Then

respu = n1 - n2

TextBox1.Text = respu

 

End If

 

If (opera = 5) Then

respu = n1 ^ n2

TextBox1.Text = respu

 

End If

 

End Sub

 

Private Sub Button18_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button18.Click

n1 = Val(TextBox1.Text)

TextBox1.Text = n1

Mod 2

 

End Sub

 

Private Sub Button19_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button19.Click

n1 = Val(TextBox1.Text)

respu = Math.Sqrt(n1)

TextBox1.Text = respu

 

End Sub

 

Private Sub Button20_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button20.Click

n1 = Val(TextBox1.Text)

respu = 1 / n1

TextBox1.Text = respu

 

End Sub

 

Private Sub Button21_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button21.Click

n1 = Val(TextBox1.Text)

respu = n1 ^ 2

TextBox1.Text = respu

 

End Sub

 

Private Sub Button22_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button22.Click

n1 = Val(TextBox1.Text)

respu = n1 ^ 2 * n1

TextBox1.Text = respu

 

End Sub

 

Private Sub Button23_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button23.Click

n1 = Val(TextBox1.Text)

opera = 5

TextBox1.Text =

" "

 

End Sub

 

Private Sub Button24_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button24.Click

n1 = Val(TextBox1.Text)

respu = 0 - n1

TextBox1.Text = respu

 

End Sub

 

Private Sub Button28_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button28.Click

 

Dim pi As Double

n1 = Val(TextBox1.Text)

pi = Math.PI

TextBox1.Text = pi

 

End Sub

 

Private Sub Button25_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button25.Click

 

Dim seno As Double

 

Dim den As Double

 

If (n1 < 180) Then

 

End If

respu = 0

 

If (n1 > 180) Then

n1 = Val(TextBox1.Text)

den = 180 / n1

seno = Math.Sin(Math.PI / den)

TextBox1.Text = seno

TextBox1.Text = respu

 

End If

 

End Sub

 

Private Sub coseno_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles coseno.Click

 

Dim coseno As Double

 

Dim den As Double

n1 = Val(TextBox1.Text)

den = 180 / n1

coseno = Math.Cos(Math.PI / den)

TextBox1.Text = coseno

 

End Sub

 

Private Sub Button27_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button27.Click

 

Dim tangente As Double

 

Dim den As Double

n1 = Val(TextBox1.Text)

den = 180 / n1

tangente = Math.Tan(Math.PI / den)

TextBox1.Text = tangente

 

End Sub

 

Private Sub Button26_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button26.Click

 

Dim fac As Double

n1 = Val(TextBox1.Text)

fac = 1

 

While (n1 <> 0)

fac = fac * n1

n1 = n1 - 1

TextBox1.Text = fac

 

End While

 

End Sub

End

 

Class

Comentar este post

mpi9091h4ck3r 11/03/2011


Gracias loco, excelente tu aporte fue el mejor código para una calculadora para visual basic que encontré en Internet te felicito tío gran aporte.


Roberto 15/07/2011


holaq buena la calcu vere si corre pero de todas maneras nose talvez es mucho pedir pero quisera el diagrama de flujo de esta calculadora te lo ruego y mandamela ami correo cejex@hotmail.com


alexander 24/08/2011


gracias me va hacer muy util


beto 18/11/2011


eii pero como se cual es cada numero de boton? ayuda porfa


Leandro 30/11/2011

socio la verdad que te doy un millon de gracias estaba buscando esta calculadora por todos lados y no la encontraba hasta que me encontre con este sitio. La verdad que muchas gracias se lo
agradesco y siga asi que muchas personas se lo agradecran.
XD