private void button3_Click(object sender, EventArgs e) { details temp = new details(this); temp.Show(); this.Hide(); }
private void button1_Click(object sender, EventArgs e) { int[,] temp = new int[matriz.ColumnCount, matriz.RowCount]; int s = 0; foreach (DataGridViewRow row in matriz.Rows) { for (int i = 0; i < matriz.ColumnCount; i++) { try { if (i + 1 == matriz.ColumnCount && s + 1 == matriz.RowCount) { temp[i, s] = 0; } else { try { temp[i, s] = int.Parse(row.Cells[intToLetter(i)].Value.ToString()); } catch (NullReferenceException) { MessageBox.Show("Empty cells"); temp = null; return; } } } catch (FormatException) { MessageBox.Show("Value Incorrect, pls only number in table"); temp = null; return; }catch (Exception) { MessageBox.Show("Error With Sintaxys"); temp = null; return; } } s++; } mp = new int[matriz.ColumnCount - 1, matriz.RowCount - 1]; x = new int[matriz.ColumnCount - 1]; y = new int[matriz.RowCount - 1]; for (int i = 0; i < matriz.ColumnCount; i++) { for (s = 0; s < matriz.RowCount; s++) { if (i + 1 == matriz.ColumnCount) { if (s + 1 != matriz.RowCount) { y[s] = temp[i, s]; } } else { if (s + 1 == matriz.RowCount) { x[i] = temp[i, s]; } else { mp[i, s] = temp[i, s]; } } } } Matriz nuevo = new Matriz(mp, x, y); M_Eno m = new M_Eno(nuevo); GenerarExcel g = new GenerarExcel(m, "Prueba1"); System.Diagnostics.Process.Start(Environment.CurrentDirectory + @"\Result.xlsx"); MessageBox.Show("Libro Generado"); m = null; nuevo = null; }