UNIVERSIDAD GERARDO
BARRIOS
ALUMNO:
JOSE ALFREDO CASTRO JOYA
ASIGNATURA :
PROGRAMACION
COMPUTACIONAL 1
INGENIERA:
GISELA ESPINOZA
CARRERA:
INGENERIA EN SISTEMAS
GRUPO:
A
EJERCICIO1
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
ComboBox1.Items.Add("Suma")
ComboBox1.Items.Add("Resta")
ComboBox1.Items.Add("Division")
ComboBox1.Items.Add("Multiplicacion")
End Sub
Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles
ComboBox1.SelectedIndexChanged
Dim a As Double
Dim b As Double
Dim c As Double
Dim operadores As String
a = TextBox1.Text
b = TextBox2.Text
c = 0
operadores = ComboBox1.Text
If operadores = "Suma" Then
c = a + b
ElseIf operadores = "Resta" Then
c = a - b
ElseIf operadores = "Division" Then
c = a / b
ElseIf operadores = "Multiplicacion" Then
c = a * b
Else
MsgBox("No selecciono ninguna operacion")
End If
Label4.Text = c
EJERCICIO2
Formulario1
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
If Form2.login = 1 Then
ComboBox1.Items.Add("Suma")
ComboBox1.Items.Add("Resta")
ComboBox1.Items.Add("Division")
ComboBox1.Items.Add("Multiplicacion")
Label6.Text = "ugb"
ElseIf Form2.login = 2 Then
ComboBox1.Items.Add("Resta")
ComboBox1.Items.Add("Division")
ComboBox1.Items.Add("Multiplicacion")
Label6.Text = "ugbSM"
ElseIf Form2.login = 3 Then
ComboBox1.Items.Add("Suma")
Label6.Text = "invitado"
End If
End Sub
Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles
ComboBox1.SelectedIndexChanged
Dim a As Double
Dim b As Double
Dim c As Double
Dim operadores As String
a = TextBox1.Text
b = TextBox2.Text
c = 0
operadores = ComboBox1.Text
If operadores = "Suma" Then
c = a + b
ElseIf operadores = "Resta" Then
c = a - b
ElseIf operadores = "Division" Then
c = a / b
ElseIf operadores = "Multiplicacion" Then
c = a * b
Else
MsgBox("No selecciono ninguna operacion")
End If
Label4.Text = c
End Sub
End Class
FORMULARIO 2
Public Class Form2
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
star(USER.Text)
End Sub
Private Sub Form2_Load(sender As Object, e As EventArgs) Handles MyBase.Load
End Sub
Public login As Integer
Public Function star(ByVal USER As String)
If USER = "ugb" Then
login = 1
Form1.Show()
ElseIf USER = "ugbSM" Then
login = 2
Form1.Show()
ElseIf USER = "invitado" Then
login = 3
Form1.Show()
End If
End Function
End Class

Practica 5

  • 1.
    UNIVERSIDAD GERARDO BARRIOS ALUMNO: JOSE ALFREDOCASTRO JOYA ASIGNATURA : PROGRAMACION COMPUTACIONAL 1 INGENIERA: GISELA ESPINOZA CARRERA: INGENERIA EN SISTEMAS
  • 2.
    GRUPO: A EJERCICIO1 Public Class Form1 PrivateSub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load ComboBox1.Items.Add("Suma") ComboBox1.Items.Add("Resta") ComboBox1.Items.Add("Division") ComboBox1.Items.Add("Multiplicacion") End Sub Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox1.SelectedIndexChanged Dim a As Double Dim b As Double Dim c As Double Dim operadores As String a = TextBox1.Text b = TextBox2.Text c = 0 operadores = ComboBox1.Text If operadores = "Suma" Then c = a + b ElseIf operadores = "Resta" Then c = a - b ElseIf operadores = "Division" Then c = a / b ElseIf operadores = "Multiplicacion" Then c = a * b Else MsgBox("No selecciono ninguna operacion") End If Label4.Text = c
  • 3.
    EJERCICIO2 Formulario1 Public Class Form1 PrivateSub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load If Form2.login = 1 Then ComboBox1.Items.Add("Suma") ComboBox1.Items.Add("Resta") ComboBox1.Items.Add("Division") ComboBox1.Items.Add("Multiplicacion") Label6.Text = "ugb" ElseIf Form2.login = 2 Then ComboBox1.Items.Add("Resta") ComboBox1.Items.Add("Division") ComboBox1.Items.Add("Multiplicacion") Label6.Text = "ugbSM" ElseIf Form2.login = 3 Then ComboBox1.Items.Add("Suma") Label6.Text = "invitado" End If End Sub Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox1.SelectedIndexChanged Dim a As Double Dim b As Double Dim c As Double
  • 4.
    Dim operadores AsString a = TextBox1.Text b = TextBox2.Text c = 0 operadores = ComboBox1.Text If operadores = "Suma" Then c = a + b ElseIf operadores = "Resta" Then c = a - b ElseIf operadores = "Division" Then c = a / b ElseIf operadores = "Multiplicacion" Then c = a * b Else MsgBox("No selecciono ninguna operacion") End If Label4.Text = c End Sub End Class FORMULARIO 2 Public Class Form2 Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click star(USER.Text) End Sub Private Sub Form2_Load(sender As Object, e As EventArgs) Handles MyBase.Load End Sub Public login As Integer Public Function star(ByVal USER As String) If USER = "ugb" Then login = 1 Form1.Show() ElseIf USER = "ugbSM" Then login = 2 Form1.Show() ElseIf USER = "invitado" Then login = 3 Form1.Show() End If End Function
  • 5.