viernes, 14 de noviembre de 2008

Codigo para calcular area y volumen de un cilindro


Dim num1, num2, resp As Double
Const pi As Double = 3.1416

Private Sub Command1_Click()
resp = 2 * pi * num1 * (num1 * num2)
Text3.Text = resp
End Sub

Private Sub Command2_Click()
resp = pi * num1 * num1 * num2
Text4.Text = resp
End Sub

Private Sub Command3_Click()
Text1.Text = " "
Text2.Text = " "
Text3.Text = " "
Text4.Text = " "
Text1.SetFocus
End Sub

Private Sub Command4_Click()
End
End Sub

Private Sub Text1_Change()
If Text1.Text <> " " Then
num1 = Val(Text1.Text)
End If
End Sub

Private Sub Text2_Change()
If Text2.Text <> " " Then
num2 = Val(Text2.Text)
End If
End Sub

3 comentarios:

mareve dijo...

muy buenos estos codigos pero solo que necesito el codigo del area de un cilindro y otro donde me pida 3 numeros y comparar que el mensaje que mande me diga cual de los tres es el mayor el menor y el intermedio

Anónimo dijo...
Este comentario ha sido eliminado por el autor.
Anónimo dijo...
Este comentario ha sido eliminado por el autor.