Muchas gracias Elektro. aquí comparte el código para sumar elementos de filas impares de una matriz en DataGridView
Código (vbnet) [Seleccionar]
Dim i, j As Integer
Dim tabla(5, 5) As String
'Pedir valores
With DataGridView1
.Columns.Add("", "")
.Columns.Add("", "")
.Columns.Add("", "")
.Columns.Add("", "")
.Columns.Add("", "")
.RowCount = 5
For i = 0 To 4
For j = 0 To 4
tabla(i, j) = InputBox("Digite un número")
.Item(i, j).Value = tabla(i, j)
Next
Next
End With
'Filas impares
Dim fila1 As Integer = 0
Dim fila3 As Integer = 2
Dim fila5 As Integer = 4
Dim sumFila1 As Integer = (From cell As DataGridViewCell In DataGridView1.Rows(fila1).Cells Select CInt(cell.Value)).Sum
Dim sumFila3 As Integer = (From cell As DataGridViewCell In DataGridView1.Rows.Item(fila3).Cells Select CInt(cell.Value)).Sum
Dim sumFila5 As Integer = (From cell As DataGridViewCell In DataGridView1.Rows.Item(fila5).Cells Select CInt(cell.Value)).Sum
Label1.Visible = True
Label1.Text = "La suma de los valores de la primer fila es de " & sumFila1
Label3.Visible = True
Label3.Text = "La suma de los valores de la tercera fila es de " & sumFila3
Label5.Visible = True
Label5.Text = "La suma de los valores de la quinta fila es de " & sumFila5