Script 1
Option
Explicit On
Public Class
Form1
REM
Declaración de variables
Const
Pi As Single =3.141592654
Dim
R, H, V As Single
REM
Contenido del formulario
Private Sub
Form1_Load(ByVal sender As Sytem.Object, ByVal e As Syste.EventArgs) Handles
MyBase.Load
Me.Text
= “Cálculo volumen cilindro”
ButtonCalcular.Text
= “Calcular Volumen”
Label1.Text = “Introduzca aquí el
diámetro, en metros”
Label2.Text = “Introduzca aquí la
altura, en metros”
End Sub
REM Cálculo
y muestra resultados
Private Sub
Button1 Click(ByVal sender As Sytem.Object, ByVal e As Sytem.EventArgs) Handles
ButtonCalcular.Click
R
= Val(TextBox1.Text) / 2
H
= Val(TextBox2.Text)
V
= Pi * (R ^ 2) * H
LabelResultados.Font
= New Font(“Arial”, 10, FontStyle.Bold)
LabelResultados.textAlign
= ContentAligment.MiddleCenter
LabelResultados.Text
= “El volumen del cilindro es de “ & V & “ metros cúbicos”
En Sub
End Class
Calcular el promedio
de tres notas sumativos
Option Explicit On
Public Class Form1
REM Declaración de variables
Dim nota1, nota2, nota3, promedio As Single
Rem Contenido de formulario
Private Sub Form1_Load(ByVal sender As Sytem.Object, ByVal e As System.EventArgs) Handles
My Base.Load
Me.Text = “Cálculo promedio de 3 notas sumativas”
ButtonCalcular.Text = “Calcular el promedio”
Label1.Text = “Introduzca la primera notas”
Label2.Text = “Introduzca la segunda nota”
Label3.Text = “Introduzca la tercera nota”
End Sub
Public Class Form1
REM Declaración de variables
Dim nota1, nota2, nota3, promedio As Single
Rem Contenido de formulario
Private Sub Form1_Load(ByVal sender As Sytem.Object, ByVal e As System.EventArgs) Handles
My Base.Load
Me.Text = “Cálculo promedio de 3 notas sumativas”
ButtonCalcular.Text = “Calcular el promedio”
Label1.Text = “Introduzca la primera notas”
Label2.Text = “Introduzca la segunda nota”
Label3.Text = “Introduzca la tercera nota”
End Sub
REM Cálculo y muestra resultados
Private Sub Button1Click(ByVal sender As System.Object, ByVal e As System.Event Args) Handles
ButtonCalcular.Click
Nota1 = Val(TextBox1.Text)
Nota2 = Val(TextBox2.Text)
Nota3 = Val(TextBox3.Text)
Promedio = (Nota1 + Nota2 + Nota3)/3
LabelResultados.Font = New Font)”Arial”, 10, FontStyle.Bold)
LabelResultados.TextAlign = ContentAligment.MiddleCenter
LabelResultados.Text = “Elpromedio es de “&pormedio&”
Private Sub Button1Click(ByVal sender As System.Object, ByVal e As System.Event Args) Handles
ButtonCalcular.Click
Nota1 = Val(TextBox1.Text)
Nota2 = Val(TextBox2.Text)
Nota3 = Val(TextBox3.Text)
Promedio = (Nota1 + Nota2 + Nota3)/3
LabelResultados.Font = New Font)”Arial”, 10, FontStyle.Bold)
LabelResultados.TextAlign = ContentAligment.MiddleCenter
LabelResultados.Text = “Elpromedio es de “&pormedio&”
En Sub
No hay comentarios.:
Publicar un comentario