You are on page 1of 1

Public Class Form1

Const c = 50
Dim Nom(c) As String
Dim n1, n2, n3 As Byte
Dim pro(c), may As Single
Dim nfila, ka, f As Integer

Private Sub Butejecutar_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Butejecutar.Click
nfila = nutfilas.Value
may = -0.01
dgvmatris.RowCount = nfila
dgvmatris.ColumnCount = 6
For fila = 0 To nfila - 1
Nom(fila) = InputBox(fila, "ingrese nombre")
dgvmatris.Rows(fila).Cells(1).Value = Nom(fila)

n1 = InputBox(fila + 1, "ingrese nota1")


dgvmatris.Rows(fila).Cells(2).Value = n1
n2 = InputBox(fila + 1, "ingrese nota2")
dgvmatris.Rows(fila).Cells(3).Value = n2
n3 = InputBox(fila + 1, "ingrese nota3")
dgvmatris.Rows(fila).Cells(4).Value = n3
6:
pro(fila) = Math.Round((n1 + n2 + n3) / 3, 1)
dgvmatris.Rows(fila).Cells(5).Value = pro(fila)
If pro(fila) >= 10.5 Then
ka = ka + 1
End If
If pro(fila) >= may Then
may = pro(fila)
f = fila
End If
Next
lblapro.Text = ka
lblmay.Text = may
lblnom.Text = Nom(f)
End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles MyBase.Load
Butejecutar.Enabled = False
End Sub

Private Sub nutfilas_ValueChanged(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles nutfilas.ValueChanged
Butejecutar.Enabled = True
End Sub
End Class

You might also like