0% found this document useful (0 votes)
31 views2 pages

Guía 7 Pregunta 1

The code defines a class Form1 that contains two private subroutines. The BtnSalir_Click subroutine closes the form when a button is clicked. The BtnEjecutar_Click subroutine defines a 2D array M, initializes a string variable Cadena, loops through M to add its values to Cadena separated by tabs, and adds Cadena to a list control.

Uploaded by

Miguel Casas
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views2 pages

Guía 7 Pregunta 1

The code defines a class Form1 that contains two private subroutines. The BtnSalir_Click subroutine closes the form when a button is clicked. The BtnEjecutar_Click subroutine defines a 2D array M, initializes a string variable Cadena, loops through M to add its values to Cadena separated by tabs, and adds Cadena to a list control.

Uploaded by

Miguel Casas
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Public Class Form1

Private Sub BtnSalir_Click(sender As Object, e As EventArgs) Handles BtnSalir.Click


Me.Close()
End Sub
Private Sub BtnEjecutar_Click(sender As Object, e As EventArgs) Handles
BtnEjecutar.Click
Dim M(,) As Integer = {{0, 0, 0, 0}, {0, 30, 15, 17}, {0, 23, 12, 14}, {0, 41, 12, 17},
{0, 23, 23, 11}}
Dim Cadena As String
'Inicializar
Cadena = ""
For j = 1 To 3
Cadena = Cadena & vbTab & j
Next
LstMostrar.Items.Add(Cadena)
For i = 1 To 4
Cadena = i
For j = 1 To 3
Cadena = Cadena & vbTab & M(i, j)
Next
LstMostrar.Items.Add(Cadena)
Next
End Sub
End Class

PREGUNTA 1
Public Class Form1
Private Sub BtnSalir_Click(sender As Object, e As EventArgs) Handles BtnSalir.Click
Me.Close()
End Sub
Private Sub BtnEjecutar_Click(sender As Object, e As EventArgs) Handles
BtnEjecutar.Click
Dim i, j As Byte
Dim Cadena As String
Dim N As Integer
Dim A(4, 5), B(4, 5) As Integer
'Pedir N
N = Val(InputBox("Ingese valor de N"))
'Recorrer matriz
For i = 1 To 4
For j = 1 To 5
'Pedir a(i,j)
A(i, j) = Val(InputBox("Ingrese valor para fila: " & i & " y la columna: " & j))
'Calcular B(i,j)
B(i, j) = A(i, j) * N
Next
Next

'Inicializar
Cadena = ""
For j = 1 To 5
Cadena = Cadena & vbTab & j
Next
LstMostrar.Items.Add(Cadena)
For i = 1 To 4
Cadena = i
For j = 1 To 5
Cadena = Cadena & vbTab & A(i, j)
Next
LstMostrar.Items.Add(Cadena)
Next
Cadena = ""
For j = 1 To 5
Cadena = Cadena & vbTab & j
Next
LstMostrar.Items.Add(Cadena)
For i = 1 To 4
Cadena = i
For j = 1 To 5
Cadena = Cadena & vbTab & B(i, j)
Next
LstMostrar.Items.Add(Cadena)
Next
End Sub
End Class

You might also like