sábado, 26 de noviembre de 2016

Trabajo Final de Macros

- Días de la Semana

Código:
Private Sub CommandButton1_Click()
Dim I As Integer
I = CInt(TextBox1.Text)
Select Case I
Case 1
Label1.Caption = "Domingo"
Case 2
Label1.Caption = "Lunes"
Case 3
Label1.Caption = "Martes"
Case 4
Label1.Caption = "Miercoles"
Case 5
Label1.Caption = "Jueves"
Case 6
Label1.Caption = "Viernes"
Case 1
Label7.Caption = "Sabado"
End Select


End Sub

Imagen Depurando el Programa:






- Factorial

Código:
Private Sub CommandButton1_Click()
Dim n, x, f As Double
n = CInt(TextBox1.Text)
f = 1
For x = 1 To n
f = f * x
Label1.Caption = f
Next x
End Sub

Imagen Depurando el Programa: 




- Pesos a Euros
Código:
Private Sub calcular_Click()
Dim p, r, u As Double
p = CInt(TextBox1.Text)
u = 21.87
r = p / u
lbl1.Caption = r

End Sub

Imagen Depurando el Programa:



- Media de 4 Números
Código:
Private Sub CommandButton1_Click()
 Dim a, b, c, d, m, div As Double
        a = CInt(TextBox1.Text)
        b = CInt(TextBox2.Text)
        c = CInt(TextBox3.Text)
        d = CInt(TextBox4.Text)
        div = 4
        m = (a + b + c + d) / (div)
        Label2.Caption = (m)
End Sub
Imagen Depurando el Programa:



- Impresión hasta el numero 57 (con while)

Código:
Private Sub calcular_Click()
Dim n, i As Integer
i = 0
n = Val(InputBox("Indique hasta cual numero desea ver su susecion"))
While i < n
i = i + 1
ListBox1.AddItem i
Wend
End Sub

Private Sub limpiar_Click()
ListBox1.Clear
End Sub

Imagen Depurando el Programa:



 -Impresión hasta el numero 57 (con for)

Código:
Private Sub calcular_Click()
Dim n, i  As Integer
n = Val(InputBox("Indique hasta cual numero desea ver su sucecion"))
i = 1
Do
ListBox1.AddItem i
i = i + 1
Loop While i <= n

End Sub

Private Sub limpiar_Click()
ListBox1.Clear
End Sub

Imagen Depurando el Programa:



- Media, Mayor y Menor de un Conjunto Fijo

Código:
Dim cal(10) As Double
Dim fila, c As Integer
Dim suma, prom As Double

Private Sub BtnGuardar_Click()
 If fila < 10 Then
            If TxtCal.Text < 0 Then
                MsgBox ("Solo calificaciones de 0 a 10")
                TxtCal.Text = ""
            Else
                If TxtCal.Text > 10 Then
                    MsgBox ("Solo calificaiones de 0 a 10")
                    TxtCal.Text = ""
                Else
                    cal(fila) = CInt(TxtCal.Text)
                    fila = fila + 1
                    
                    
                    TxtCal.Text = ""
                End If
            End If
        Else
            MsgBox ("Base de datos llena")
        End If
End Sub
Private Sub BtnMostrar_Click()
Dim mayor, menor As Integer

    For i = 0 To 9
       c = cal(i)
            ListCal.AddItem (c)
    Next
    
    suma = 0
    For i = 0 To 10
            suma = suma + cal(i)
    Next
    prom = suma / 10
    TxtMedia.Text = prom
    
    For i = 0 To ListCal.ListCount - 1
    If ListCal.List(i) > mayor Then
    mayor = ListCal.List(i)
    End If
    Next
    TxtMayor.Text = mayor
    
    menor = mayor
    For i = 0 To ListCal.ListCount - 1
    If ListCal.List(i) < menor Then
    menor = ListCal.List(i)
    End If
    Next
    TxtMenor.Text = menor
    
End Sub
Private Sub BtnLimpiar_Click()
ListCal.Clear
TxtMayor.Text = ""
TxtMenor.Text = ""
TxtMedia.Text = ""
TxtCal.Text = ""

End Sub

Imagen Depurando el Programa:


viernes, 4 de noviembre de 2016

Ejercicios de Matrices (12)

Ejercicio 1: Media, mayor y menor de un conjunto fijo.
Realizar un programa que pida las notas de 40 alumnos por pantalla y muestre un menú́ de opciones: 1. Listar notas, 2. Calcular la media, 3. Calcular el menor, 4. Calcular el mayor.
YA ANTES SUBIDO

Ejercicio 2: Media, mayor y menor de un conjunto prefijado.
Igual que el apartado anterior, pero en vez de 20 alumnos ahora el número de alumnos se le preguntará al usuario al iniciar el programa, este número no podrá́ superar los 100 alumnos (controlar que el usuario introduzca un número menor que 100).
YA ANTES SUBIDO

Ejercicio 3: Arrays multidimensionales. Edificio1.
Se quiere controlar el número de habitantes de un edificio con 6 pisos y 4 puertas (A, B, C, y D) en cada piso.
Realizar un programa que pida al usuario que introduzca el número de habitantes de cada puerta del edificio. El programa debe decir la vivienda (piso y puerta) que más habitantes tiene del edificio.
Código:
Public Class Form1
    Dim Datos(6, 4) As Integer
    Private Sub Mayor()
        Dim fila, columna, piso, faux, caux, temp As Integer
        Dim puerta As String
        fila = 0
        columna = 0
        puerta = ""
        For faux = 0 To 5
            For caux = 0 To 3
                If Datos(fila, columna) < Datos(faux, caux) Then
                    temp = Datos(fila, columna)
                    Datos(fila, columna) = Datos(faux, caux)
                    Datos(faux, caux) = temp
                    Select Case faux
                        Case 0
                            piso = 1
                        Case 1
                            piso = 2
                        Case 2
                            piso = 3
                        Case 3
                            piso = 4
                        Case 4
                            piso = 5
                        Case 5
                            piso = 6
                    End Select
                    Select Case caux
                        Case 0
                            puerta = "A"
                        Case 1
                            puerta = "B"
                        Case 2
                            puerta = "C"
                        Case 3
                            puerta = "D"
                    End Select
                End If
            Next
        Next
        lbl1.Text = Datos(0, 0)
        Lblp.Text = "Piso" + "" + piso.ToString
        Lblpuerta.Text = "Puerta" + "" + puerta



    End Sub

    Private Sub BtnCap_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnCap.Click
        Dim fila, columna As Integer
        LblContenidoMa.Text = ""
        Try
            For fila = 0 To 5
                For columna = 0 To 3
                    Datos(fila, columna) = InputBox("Digite un Numero de habitantes")
                    LblContenidoMa.Text = LblContenidoMa.Text + Space(15) + Datos(fila, columna).ToString
                Next
                LblContenidoMa.Text = LblContenidoMa.Text + vbCrLf + vbCrLf
            Next
            Mayor()
        Catch ex As Exception
            MsgBox("Debe insertar datos numericos")
        End Try
    End Sub

    Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Lblp.Click

    End Sub

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

    End Sub
End Class


Imagen Depurando el Programa:




Ejercicio 4: Arrays multidimensionales. Edificio2.
Se quiere controlar el número de habitantes de un edificio con 6 pisos y 4 puertas (A, B, C, y D) en cada piso.
Realizar un programa que pida al usuario que introduzca el número de habitantes de cada puerta del edificio. El programa debe mostrar la media de habitantes de cada piso.
Código:
Public Class Form1
    Dim datos(5, 3) As Integer

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim fila, columna As Integer
        Dim promfila As Double
        lblmatriz.Text = ""
        Try
            For fila = 0 To 5
                For columna = 0 To 3
                    datos(fila, columna) = InputBox("digite un numero")
                    lblmatriz.Text = lblmatriz.Text + Space(14) + datos(fila, columna).ToString
                    promfila = promfila + (datos(fila, columna)) / 4

                Next
                lblpromfila.Text = lblpromfila.Text + promfila.ToString + vbCrLf + vbCrLf
                promfila = 0
                lblmatriz.Text = lblmatriz.Text + vbCrLf + vbCrLf
            Next
        Catch ex As Exception
            MsgBox("debes insertar numeros")
            lblmatriz.Text = ""

        End Try
    End Sub

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

    End Sub

End Class



Imagen Depurando el Programa:


Ejercicio 5:
Escriba un programa que permita obtener el número de elementos positivos de un vector de 10 elementos.
Código:
Public Class Form1
    Dim vecnums(9) As Double
    Dim negativos As Double
    Dim fila% = 0
    Private Sub guardar()
        If fila < 10 Then
            vecnums(fila) = txtnum.Text
            MsgBox("calificacion guardada", MsgBoxStyle.Information, MsgBoxStyle.OkOnly)
            txtnum.Text = ""
            fila = fila + 1
            txtnum.Focus()
        Else
            MsgBox("base de datos llena solo 10 numeros")
        End If
    End Sub
    Private Sub mostrar()
        For i = 0 To 9
            If vecnums(i) > 0 Then
                negativos = vecnums(i)
                lstnumerospos1.Items.Add(negativos.ToString)

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

    End Sub

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

    End Sub

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

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

    End Sub

End Class



Imagen Depurando el Programa:



Ejercicio 6:
Calcular el número de elementos negativos, cero y positivo de un vector de 20 elementos.
Código:
Public Class Form1
    Dim elementos(20) As Integer
    Dim i As Integer

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        For i = 0 To 19
            elementos(i) = InputBox("digita numero")
            If elementos(i) < 0 Then
                lstnegativos.Items.Add(elementos(i))
            ElseIf elementos(i) = 0 Then
                lstcero.Items.Add(elementos(i))
            ElseIf elementos(i) > 0 Then
                lstpostivos.Items.Add(elementos(i))

            End If
            lblcero.Text = lstcero.Items.Count

            lblnega.Text = lstnegativos.Items.Count
            lblpos.Text = lstpostivos.Items.Count
        Next

    End Sub

End Class


Imagen Depurando el Programa:


Ejercicio 7:
Hacer un programa que permita insertar o eliminar elementos de un arreglo.
Código:
Public Class Form1
    Dim arreglo() As Integer



    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Crear.Click
        Dim n As Integer
        n = TxtTamaño.Text
        ReDim arreglo(n)

        MsgBox("Tamaño del Arreglo Guardado", MsgBoxStyle.Information, MsgBoxStyle.OkOnly)
        TxtTamaño.Text = ""
        TxtAgregar.Focus()



    End Sub
 
    Private Sub BtnAgregar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnAgregar.Click
        Dim m As Integer
        m = TxtAgregar.Text
        ReDim Preserve arreglo(m)
        MsgBox("Elementos Agregados", MsgBoxStyle.Information, MsgBoxStyle.OkOnly)

        TxtAgregar.Text = ""
        TxtAgregar.Focus()

    End Sub

    Private Sub BtnBorrar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnBorrar.Click
        Erase arreglo
        TxtTamaño.Focus()

    End Sub

    Private Sub BtnCerrar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnCerrar.Click
        Me.Close()

    End Sub

End Class



Imagen Depurando el Programa:


Ejercicio 8:
Sean A(m,n) y B(n) una matriz y un arreglo respectivamente, hacer un programa que asigne valores a A, a partir de B teniendo en cuenta los siguientes criterios:
A(m,n)=(m) si m<=n
A(m,n)=0 si m>n
Código:


Imagen Depurando el Programa:


Ejercicio 9:
Hacer un programa que intercambie las filas de una matriz. Los elementos de la fila 0 deben intercambiarse con los de la fila N, la fila 1 con los de la fila N-1 y así sucesivamente. Imprimir las dos matrices.
Código:


Imagen Depurando el Programa:


Ejercicio 10:
Hacer programa de un arreglo de 15 elementos, tipo entero. Presentar contenido desordenado en caja de texto o lista. Presentar contenido ordenado en caja de texto o lista, del mayor al menor.
Código:
Public Class Form1
    Dim arreglo(15) As Integer
    Dim fila As Integer
    Dim c As Integer
    Dim d As Integer
    Private Sub guardar()
        If fila < 15 Then
            arreglo(fila) = txtnumero.Text
            fila = fila + 1
            MsgBox("el numero ha sido guardado")
        Else
            MsgBox("solo se aceptan 15 numeros")

        End If
        txtnumero.Text = ""
        txtnumero.Focus()

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

    End Sub

    Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click
        For i = 1 To 15
            c = arreglo(i)
            lstdesordenado.Items.Add(c)

        Next
    End Sub

    Private Sub Button3_Click(sender As System.Object, e As System.EventArgs) Handles Button3.Click
        Array.Sort(arreglo)
        For i = 0 To 15
            c = arreglo(i)
            lstordenado.Items.Add(c)

        Next
    End Sub

End Class



Imagen Depurando el Programa:


Ejercicio 11:
Matriz dinámica bidimensional, tipo cadena de caracteres, presentar datos.
 Código:
Public Class Form1
    Dim Datos(,) As String
    Dim F, C As Integer


    Private Sub Guardar()
        F = TextBoxCantFil.Text
        C = TextBoxCanCol.Text
        ReDim Datos(F - 1, C - 1)

    End Sub

    Private Sub BtnCapturarNumeros_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnCapturarNumeros.Click
        Guardar()

        Dim fila, columna As Integer
        LblMatriz.Text = ""
        Try
            For fila = 0 To F - 1
                For columna = 0 To C - 1
                    Datos(fila, columna) = InputBox("Teclee un Nombre")
                    LblMatriz.Text = LblMatriz.Text + Space(15) + Datos(fila, columna).ToString

                Next
                LblMatriz.Text = LblMatriz.Text + vbCrLf + vbCrLf
            Next
     

        Catch ex As Exception
            MsgBox("Debe Insertar Una Cadena de Caracteres")
            LblMatriz.Text = ""

        End Try

    End Sub

    Private Sub BtnSalir_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnSalir.Click
        Me.Close()

    End Sub

   


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

    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class


Imagen Mostrando La Depuración:


Ejercicio 12:

Matriz dinámica bidimensional numérica. Presentar promedio por fila y columna.

 Código:
Public Class Form1
    Dim Datos(,) As Integer
    Dim F, C As Integer


    Private Sub Guardar()
        F = TextBoxCantFil.Text
        C = TextBoxCanCol.Text
        ReDim Datos(F - 1, C - 1)

    End Sub

    Private Sub BtnCapturarNumeros_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnCapturarNumeros.Click
        Guardar()
        Dim fila, columna, sfilas, scolumnas As Integer
        LblMatriz.Text = ""
        Try
            For fila = 0 To F - 1
                For columna = 0 To C - 1
                    Datos(fila, columna) = InputBox("Digite un Numero")
                    LblMatriz.Text = LblMatriz.Text + Space(15) + Datos(fila, columna).ToString
                    sfilas = sfilas + Datos(fila, columna)
                Next
                LblNumF.Text = ((LblNumF.Text + sfilas.ToString) / C).ToString + vbCrLf + vbCrLf
                sfilas = 0
                LblMatriz.Text = LblMatriz.Text + vbCrLf + vbCrLf
            Next
            For columna = 0 To C - 1
                For fila = 0 To F - 1
                    scolumnas = scolumnas + Datos(fila, columna)
                Next
                LbLNumC.Text = ((LbLNumC.Text + Space(14) + scolumnas.ToString) / F).ToString
                scolumnas = 0
            Next
        Catch ex As Exception
            MsgBox("Debe Insertar Datos Numericos")
            LblMatriz.Text = ""
            LbLNumC.Text = ""
            LblNumF.Text = ""


        End Try




    End Sub

    Private Sub BtnSalir_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnSalir.Click
        Me.Close()

    End Sub





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

    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub

End Class


Imagen Depurando el Programa:


Ejercicio II de Matrices

Código:
Public Class Form1
    Dim Datos(2, 3) As Integer

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub

    Private Sub BtnCapturarNumeros_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnCapturarNumeros.Click
        Dim fila, columna, sfilas, scolumnas As Integer
        LblMatriz.Text = ""
        Try
            For fila = 0 To 2
                For columna = 0 To 3
                    Datos(fila, columna) = InputBox("Digite un Numero")
                    LblMatriz.Text = LblMatriz.Text + Space(15) + Datos(fila, columna).ToString
                    sfilas = sfilas + Datos(fila, columna)
                Next
                LblNumF.Text = LblNumF.Text + sfilas.ToString + vbCrLf + vbCrLf
                sfilas = 0
                LblMatriz.Text = LblMatriz.Text + vbCrLf + vbCrLf
            Next
            For columna = 0 To 3
                For fila = 0 To 2
                    scolumnas = scolumnas + Datos(fila, columna)
                Next
                LbLNumC.Text = LbLNumC.Text + Space(14) + scolumnas.ToString
                scolumnas = 0
            Next
        Catch ex As Exception
            MsgBox("Debe Insertar Datos Numericos")
            LblMatriz.Text = ""
            LbLNumC.Text = ""
            LblNumF.Text = ""


        End Try

    End Sub

    Private Sub BtnSalir_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnSalir.Click
        Me.Close()

    End Sub
End Class


Imagen Mostrando el Programa:


Ejercicio I de Matrices


Ejercicio de Ventas Agregándole el Articulo

Código:
Public Class Form1
    Dim venta(12) As Double
    Dim i As Integer
    Dim Articulo(12) As String



    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnIngresar.Click
        i = TxtMes.Text
        If i >= 1 And i <= 12 Then
            venta(i) = TxtVenta.Text
            Articulo(i) = TextBoxArticulo.Text
        Else
            MsgBox("Ingrese valor entre 1 y 12")

        End If
        TxtVenta.Text = ""
        TxtMes.Text = ""
        TextBoxArticulo.Text = ""
        TxtMes.Focus()



    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnLista.Click
        i = 1
        DataGridView1.Rows.Clear()
        Do While i <= 12
            Select Case i
                Case 1
                    DataGridView1.Rows.Add("Enero", venta(1), Articulo(1))
                Case 2
                    DataGridView1.Rows.Add("Febrero", venta(2), Articulo(2))
                Case 3
                    DataGridView1.Rows.Add("Marzo", venta(3), Articulo(3))
                Case 4
                    DataGridView1.Rows.Add("Abril", venta(4), Articulo(4))
                Case 5
                    DataGridView1.Rows.Add("Mayo", venta(5), Articulo(5))
                Case 6
                    DataGridView1.Rows.Add("Junio", venta(6), Articulo(6))
                Case 7
                    DataGridView1.Rows.Add("Julio", venta(7), Articulo(7))
                Case 8
                    DataGridView1.Rows.Add("Agosto", venta(8), Articulo(8))
                Case 9
                    DataGridView1.Rows.Add("Septiembre", venta(9), Articulo(9))
                Case 10
                    DataGridView1.Rows.Add("Octubre", venta(10), Articulo(10))
                Case 11
                    DataGridView1.Rows.Add("Noviembre", venta(11), Articulo(11))
                Case 12
                    DataGridView1.Rows.Add("Duciembre", venta(12), Articulo(12))
            End Select
            i = i + 1
        Loop

    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnBorrar.Click
        i = 1
        Do While i <= 12
            venta(i) = 0
            i = i + 1

        Loop
        For j = 0 To 12
            Articulo(j) = ""
        Next


    End Sub

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

    End Sub

    Private Sub GroupBox2_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GroupBox2.Enter

    End Sub
End Class

Imagen Mostrando la Ejecución:




Ejercicio media de N calificaciones (Máximo 100)

Código:
Public Class Form1
    Dim VecCal() As Integer
    Dim fila As Integer = 0
    Dim S As Double
    Dim N As Integer
    Dim P As Double
    Dim C As Integer

    Private Sub GUARDAR()
        If N <= 100 Then
            N = TextBoxCant.Text
            ReDim VecCal(N - 1)
        End If
        If TextBox1.Text >= 0 And TextBox1.Text <= 10 Then
            If fila < N Then
                VecCal(fila) = CInt(TextBox1.Text)
                fila = fila + 1 'pasa a la siguiente posicion
                MsgBox("Se ha guardado tu calificacion", MsgBoxStyle.Information, MsgBoxStyle.OkOnly)
                TextBox1.Text = ""
                TextBox1.Focus()
            Else
                MsgBox("Base de datos llena")
            End If
        Else
            MsgBox("Calificacion no valida")
        End If

    End Sub

    Private Sub MEDIA()
        S = 0
        For I = 0 To 9
            S = S + VecCal(I)
        Next
        P = S / 10
        LabelPromedio.Text = P

    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub

    Private Sub ButtonGuardar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonGuardar.Click
        GUARDAR()


    End Sub

    Private Sub ButtonPromedio_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonPromedio.Click
        MEDIA()

    End Sub

    Private Sub ButtonLista_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonLista.Click
        For I = 0 To N - 1
            C = VecCal(I)
            ListBox1.Items.Add(C)
        Next
    End Sub

    Private Sub ButtonMenor_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonMenor.Click
        Array.Sort(VecCal)
        LabelMenor.Text = VecCal(0).ToString


    End Sub

    Private Sub ButtonMayor_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonMayor.Click
        Array.Sort(VecCal)
        LabelMayor.Text = VecCal(9).ToString

    End Sub

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

    End Sub

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

    End Sub
End Class

Imagen Mostrando la Ejecucion