private void btnAceps_Click(object sender, RoutedEventArgs e) { try { if (cmboTablas.SelectedIndex < 0) { throw new Exception("Favor de seleccionar una tabla"); } v.TbActual = ((EntGeneral)cmboTablas.SelectedItem).Descripcion; if (rdGrid.Checked) { frmActTablas at = new frmActTablas(); at.esnuevo = true; at.ShowDialog(); } else { frmActTablaExcel at = new frmActTablaExcel(); at.esnuevo = true; at.ShowDialog(); } this.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btnEdiTabla_Click(object sender, RoutedEventArgs e) { string t = string.Empty; try { //if (dgTablas.SelectedRows.Count == 1) //{ // DataGridViewRow r = dgTablas.SelectedRows[0]; // // Entidad ent =(enbtidad) dgTablas.selecteditem(); // t = r.Cells[0].Value.ToString(); // Var v = new Var(); // v.TbActual = t; // frmActTablas ve = new frmActTablas(); // ve.esnuevo = false; // ve.ShowDialog(); //} if (dgTablas.SelectedItems.Count == 1) { // DataGridRow r = dgTablas.SelectedRows[0]; // DataGridRow r = dgTablas.Items[0]; // object r = dgTablas.Items[0]; // dgTablas.SelectedItem = r; //DataGridRow row = dgTablas.ItemContainerGenerator.ContainerFromIndex(0); DataGridRow row = (DataGridRow)dgTablas.ItemContainerGenerator .ContainerFromIndex(0); DataRow r = (DataRow)row.DataContext; t = r[0].ToString(); Var v = new Var(); v.TbActual = t; frmActTablas ve = new frmActTablas(); ve.esnuevo = false; ve.ShowDialog(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }