Operaciones basicas entre matrices de suma resta multiplicación y division

Este programa esta hecho en .Net es una Matriz
Public Class Form64
    Dim M(1, 1), M2(1, 1), M3(1, 1), Filas, Columnas As Integer
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Try
            'solicitar el tamaño
            Filas = InputBox("digite filas")
            Columnas = InputBox("digite columna")

            'redimencionar la matriz

            ReDim M(Filas, Columnas), M2(Filas, Columnas), M3(Filas, Columnas)
            'ajustar el objeto

            AxMSFlexGrid1.Rows = Filas
            AxMSFlexGrid1.Cols = Columnas
            AxMSFlexGrid2.Rows = Filas
            AxMSFlexGrid2.Cols = Columnas
            AxMSFlexGrid3.Rows = Filas
            AxMSFlexGrid3.Cols = Columnas
            'llenado de la matriz

            For i = 0 To Filas - 1
                For j = 0 To Columnas - 1
                    M(i, j) = InputBox("elementos de la matriz")
                Next
            Next
            For i = 0 To Filas - 1
                For j = 0 To Columnas - 1
                    M2(i, j) = InputBox("elementos de la matriz")
                Next
            Next
        Catch ex As Exception
            MsgBox("no digite letras ", MsgBoxStyle.Information)
        End Try
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        'visualizar
        For i = 0 To Filas - 1
            For j = 0 To Columnas - 1
                AxMSFlexGrid1.set_TextMatrix(i, j, M(i, j))
                AxMSFlexGrid2.set_TextMatrix(i, j, M2(i, j))
                AxMSFlexGrid3.set_TextMatrix(i, j, M3(i, j))
            Next
        Next
    End Sub

    Private Sub resta_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles resta.CheckedChanged
        If Me.resta.Checked = True Then

            For i = 0 To Filas - 1
                For j = 0 To Columnas - 1
                    M3(i, j) = M(i, j) - M2(i, j)

                Next
            Next
        End If
    End Sub

    Private Sub suma_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles suma.CheckedChanged
        If Me.suma.Checked = True Then

            For i = 0 To Filas - 1
                For j = 0 To Columnas - 1
                    M3(i, j) = M(i, j) + M2(i, j)
                Next
            Next
        End If
    End Sub

    Private Sub multiplicacion_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles multiplicacion.CheckedChanged
        If Me.multiplicacion.Checked = True Then

            For i = 0 To Filas - 1
                For j = 0 To Columnas - 1
                    M3(i, j) = M(i, j) * M2(i, j)
                Next
            Next
        End If

    End Sub

    Private Sub division_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles division.CheckedChanged
        If Me.division.Checked = True Then

            For i = 0 To Filas - 1
                For j = 0 To Columnas - 1
                    M3(i, j) = M(i, j) / M2(i, j)
                Next
            Next
        End If
    End Sub

End Class

Comentarios

Entradas populares de este blog

Google Glass llegará al mercado en 2014

Suma y Multiplicacion de Matrices php

Para Hombres griego