1. UNIVERSIDAD CENTRAL DEL ECUADOR
Facultad de Filosofía, Letras y Ciencias de la Educación
Jesus Alexander Haro Amaguaya
Dennis Williams Navarrete Cuaces
Informática, Tercero B
Programación III
Msc. Víctor Zapata
8 de enero de 2018
Arreglos
Diseño
Código
Public Class Form1
Dim f, c, val, par, imp, cer, un As Integer
2. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
f = InputBox("Ingrese el numero de filas", "Matriz 1")
c = InputBox("Ingrese el numero de columnas", "Matriz 1")
DataGridView1.RowCount = f
DataGridView1.ColumnCount = c
If ((f <> 0) And (c <> 0)) Then
For i = 0 To c - 1
DataGridView1.Columns(i).Width = 300 / c
Next
For j = 0 To f - 1
DataGridView1.Rows(j).Height = 225 / f
Next
Else
MsgBox("La matriz no puede ser de dimension 0, 0",
MsgBoxStyle.Critical, "Error")
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
For i = 0 To f - 1
For j = 0 To c - 1
val = InputBox("Ingrese el valor de: [" & i + 1 & ", " & j + 1 &
"]", "Ingreso")
DataGridView1.Rows(i).Cells(j).Value = val
Select Case val
Case 0
cer += 1
Case 1
un += 1
End Select
If (val Mod 2 = 0) Then
If val <> 0 Then
par += 1
End If
Else
imp += 1
End If
Next
Next
TextBox1.Text = par
TextBox2.Text = imp
TextBox3.Text = cer
TextBox4.Text = un
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click
For i = 0 To f - 1
For j = 0 To c - 1
val = 0
DataGridView1.Rows(i).Cells(j).Value = val
Next
3. Next
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button4.Click
End
End Sub
End Class
Ejecución