private void btnRespaldar_Click(object sender, EventArgs e)
 {
     if (txtRuta.TextLength != 0)
     {
         using (espera_datos.carga_tablas fe = new espera_datos.carga_tablas())
         {
             fe.Accion  = respaldardatos;
             fe.Retorno = false;
             if (fe.ShowDialog() == DialogResult.OK)
             {
                 lblRespuesta.Text      = "La base se respaldo con éxito";
                 lblRespuesta.ForeColor = Color.Green;
                 txtRuta.Text           = "";
             }
             else
             {
             }
         }
     }
 }
 private void button2_Click(object sender, EventArgs e)
 {
     if (txtBu.TextLength != 0)
     {
         using (espera_datos.carga_tablas fe = new espera_datos.carga_tablas())
         {
             fe.Accion  = importarbase;
             fe.Retorno = false;
             if (fe.ShowDialog() == DialogResult.OK)
             {
                 lblres.Text      = "La base se importo con éxito";
                 lblres.ForeColor = Color.Green;
                 txtBu.Text       = "";
             }
             else
             {
             }
         }
     }
 }
        private void cargarDatos()
        {
            if (tablad.Rows.Count != 0)
            {
                using (espera_datos.splash_espera fe = new espera_datos.splash_espera()) {
                    fe.Funcion = procesarDatos;

                    if (fe.ShowDialog() == DialogResult.OK)
                    {
                        List <DataTable> listas = fe.Funcion();
                        producto         pr     = new producto();

                        pr.txtCodigo.Text   = tablad.CurrentRow.Cells[1].Value.ToString();
                        pr.txtNombre.Text   = tablad.CurrentRow.Cells[2].Value.ToString();
                        pr.existencia.Value = Convert.ToDecimal(tablad.CurrentRow.Cells[6].Value.ToString());

                        pr.Idmarca     = tablad.CurrentRow.Cells[15].Value.ToString();
                        pr.Idcategoria = tablad.CurrentRow.Cells[16].Value.ToString();
                        pr.Idestante   = tablad.CurrentRow.Cells[17].Value.ToString();
                        pr.Kardex      = tablad.CurrentRow.Cells[18].Value.ToString();


                        if (!tablad.CurrentRow.Cells[19].Value.ToString().Equals(""))
                        {
                            pr.fecha.Value = Convert.ToDateTime(tablad.CurrentRow.Cells[19].Value.ToString());
                        }

                        pr.Marcas     = listas[0];
                        pr.Categorias = listas[1];
                        pr.Estantes   = listas[2];
                        pr.Mayoreo    = listas[3];
                        pr.Detalle    = listas[4];


                        pr.Idsuc_produ = tablad.CurrentRow.Cells[0].Value.ToString();
                        pr.Idproducto  = tablad.CurrentRow.Cells[14].Value.ToString();

                        pr.Utili_m = tablad.CurrentRow.Cells[20].Value.ToString();
                        pr.Utili_d = tablad.CurrentRow.Cells[21].Value.ToString();
                        pr.Pv      = tablad.CurrentRow.Cells[22].Value.ToString();
                        pr.Pc      = tablad.CurrentRow.Cells[23].Value.ToString();
                        pr.Pvm     = tablad.CurrentRow.Cells[24].Value.ToString();
                        pr.Pcm     = tablad.CurrentRow.Cells[25].Value.ToString();


                        pr.ShowDialog();

                        if (tablad.Rows.Count != 0)
                        {
                            tablad.CurrentCell = tablad.Rows[0].Cells[1];
                        }

                        if (pr.Actualiza)
                        {
                            using (espera_datos.carga_tablas es = new espera_datos.carga_tablas())
                            {
                                es.Productos = cargarDatosP;

                                if (es.ShowDialog() == DialogResult.OK)
                                {
                                    productos = es.Productos();
                                    cargarTablas();
                                    txtBusqueda.Focus();
                                }
                            }
                        }
                    }
                    else
                    {
                        MessageBox.Show("La carga de productos a sido cancelada...");
                    }
                }
            }
            else
            {
                txtBusqueda.Text = "";
                txtBusqueda.Focus();
            }
        }