private void Btn_calcular_Click(object sender, EventArgs e) { dgv_at = new DataGridView(); dgv_at = dgv_1; btn_calcular.Enabled = false; switch(metodo) { case 0: gauss = new GaussJordan(Dgv_dt(dgv_1)); double[] res = new double[dgv_1.RowCount]; gauss.elimGauseana(res); AddSolucion(res); break; case 1: inversa = new MatrizInversa(Dgv_dt(dgv_1)); double[,] re = inversa.MtzUnida(); if(re != null) { int fil = re.GetLength(0), f; int col = re.GetLength(1), c; string[] r = new string[col]; dgv_1.Rows.Clear(); dgv_1.Columns.Clear(); dgv_1.ColumnCount = col; dgv_1.ColumnHeadersVisible = false; for(f = 0; f < fil; f++) { for(c = 0; c < col; c++) r[c] = re[f, c].ToString(); dgv_1.Rows.Add(r); } } else { MessageBox.Show("la matriz debe ser cuadrada"); } break; case 2: dgv_1.DataSource = null; simp = new Simplex(Dgv_dt(dgv_1), Convert.ToInt32(this.num.Value), Convert.ToInt32(this.r.Value)); DataTable a = simp.GetDT(); dgv_1.Columns.Clear(); dgv_1.DataSource = a; string[] x = new string[a.Rows.Count + 1]; x = simp.GetVarPos(); for(int i = 0; i < a.Rows.Count; i++) dgv_1.Rows[i].HeaderCell.Value = x[i]; break; } }