computacion

Páginas: 8 (1753 palabras) Publicado: 8 de mayo de 2014
Curso Visual Basic
Clase
Tema
1
Variables
2
3
4
5
6
7
8
9
10

Selectivas
Repetitivas
Subprogramas
Vectores
Cadenas
Archivos
Examen1
Examen1
Examen1

Teoría
Introducción área de trabajo. Declarar, asignar, operaciones,
peradores aritméticos
Expresión lógica, operadores lógicos, Simple, Dobles, anidada
For, While
Declarar, tipo de retorno, llamar un subFuncionamiento, operaciones
Que es, operaciones
Input, output, append
Tipo archivos
Tipo cadenas
Ambos

Clase 1
Introducción área de trabajo, habilitar deshabilitar paneles, componentes, el código en
partes

Eje1
Realizar un programa en Visual Basic que permita calcular el área de un triangulo
rectángulo.
Nombre: Label1
Caption: Base

Nombre: Label2
Caption: Altura

Nombre: Text1
Text:Nombre: Text2
Text:
Nombre: Command1
Caption: Calcular

Private Sub Command1_Click()
Dim area As Double
area = (Val(Text1.Text) + Val(Text2.Text)) / 2
MsgBox ("Hola el area es: " & area)
End Sub

Eje2
Realizar un programa en Visual Basic que permita sumar, restar, multiplicar dos números
ingresados en dos cajas de textos.
1

Ronald Chipana Wariste Curso Visual Basic

Private SubcmdMulti_Click()
n1 = Val(txtNum1.Text)
n2 = Val(txtNum2.Text)
res = n1 * n2
txtRes.Text = res
End Sub
Private Sub cmdRestar_Click()
n1 = Val(txtNum1.Text)
n2 = Val(txtNum2.Text)
res = n1 - n2
txtRes.Text = res
End Sub

Private Sub cmdSumar_Click()
Dim n1, n2, res As Integer
n1 = Val(txtNum1.Text)
n2 = Val(txtNum2.Text)
res = n1 + n2
txtRes.Text = res
End Sub
Private SubcmdSalir_Click()
End
End Sub

Eje3
Se requiere un programa para calcular el salario total de un empleado dado el número de
horas trabajadas, número de horas extra y número de horas de retraso.
La empresa paga 25 Bs. hora trabajada, 35 Bs. Hora extra y descuenta 30 bs hora de
retraso.
Clase 2

Eje4
Programa que reconosca si un numero es cero, es negativo o positivo.

2

Ronald ChipanaWariste Curso Visual Basic

Private Sub cmdLeerNumero_Click()
Dim n As Integer
n = InputBox("Ingrese el numero")
If (n = 0) Then
MsgBox ("El numero " & n & " es: 0")
Else
If (n > 0) Then
MsgBox ("El numero " & n & " es: positivo")
Else
MsgBox ("El numero " & n & " es: negativo")
End If
End If
End Sub
Eje5
Leidos dos números muestre si son iguales y si no muestre cual es el mayorPrivate Sub cmdPrueba_Click()
Dim n1, n2 As Integer
n1 = InputBox("Ingrese el primer numero")
n2 = InputBox("Ingrese el segundo numero")
3

Ronald Chipana Wariste Curso Visual Basic

If (n1 = n2) Then
MsgBox (n1 & " y " & n2 & "son iguales ")
Else
If (n1 > n2) Then
MsgBox ("el mayor es: " & n1)
Else
MsgBox ("el mayor es: " & n2)
End If
End If
End Sub

Eje6
Leidos tres númerosmuestre en forma descendente.

Private Sub Command1_Click()
Dim a, b, c As Integer
a = InputBox("ingrese el 1 numero")
b = InputBox("ingrese el 2 numero")
c = InputBox("ingrese el 3 numero")
If (a > b And a > c) Then 'a
If (b > c) Then
MsgBox (a & " " & b & " " & c)
Else
MsgBox (a & " " & c & " " & b)
End If
End If
4

Ronald Chipana Wariste Curso Visual Basic

If (b > a And b > c)Then 'b
If (a > c) Then
MsgBox (b & " " & a & " " & c)
Else
MsgBox (b & " " & c & " " & a)
End If
End If
If (c > a And c > b) Then 'c
If (a > b) Then
MsgBox (c & " " & a & " " & b)
Else
MsgBox (c & " " & b & " " & a)
End If
End If
End Sub

Clase 3

Eje7
Mostrar los 10 primeros múltiplos de 3

Private Sub cmdMultiplos_Click()
Dim multi As Integer
multi = 3
lstSalida1.ClearFor i = 1 To 10 Step 1
5

Ronald Chipana Wariste Curso Visual Basic
lstSalida1.AddItem (i & " --- " & multi)
multi = multi + 3
Next i
End Sub

Eje8
Mostrar la tabla de multiplicar de un numero leído

Private Sub cmdTabla_Click()
Dim num As Integer
num = InputBox("Ingrese el numero")
For i = 1 To 10 Step 1
lstSalida1.AddItem (num & "X" & i & "=" & num * i)
Next i
End Sub...
Leer documento completo

Regístrate para leer el documento completo.

Estos documentos también te pueden resultar útiles

  • Computacion
  • Computacion
  • Computacion
  • Computacion
  • Computacion
  • Computacion
  • Computacion
  • Computacion

Conviértase en miembro formal de Buenas Tareas

INSCRÍBETE - ES GRATIS