Example #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            this.button2.Enabled     = false;
            openFileDialog1.FileName = "";
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                /* MessageBox.Show ( openFileDialog1.FileName); */
                nombreArchivo = openFileDialog1.FileName;
                textBox1.Text = openFileDialog1.FileName;

                ServiceExcel miServiceExcel = new ServiceExcel();
                miServiceExcel.InitializeExcel(textBox1.Text);
                dataGridView1.AutoSize = true;


                //listaProductos = miServiceExcel.ReadMyExcel();
                listaTarifas = miServiceExcel.ReadMyExcelTarifas();

                // A la lista la transfiere al DATASET
                this.dataSet = Extensiones.Extensions.ToDataSet(listaTarifas);
                //Al binding source le configuramos el dataset
                this.bindingSource.DataSource = this.dataSet;
                // Al binding source le configuramos su datamenber , sino no transfiere los datos al datagrid
                this.bindingSource.DataMember = this.dataSet.Tables[0].TableName;

                // dentro de este metodo esta el bindeo del datagrid al binding sourcer
                cargarDataGridViewBusqueda(this.dataGridView1, listaTarifas, this.bindingSource);
            }
            this.button2.Enabled = true;

            /* dataGridView1.Rows.Add(tranList[0]); */
        }
Example #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            this.button2.Enabled     = false;
            openFileDialog1.FileName = "";
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                /* MessageBox.Show ( openFileDialog1.FileName); */
                nombreArchivo = openFileDialog1.FileName;
                textBox1.Text = openFileDialog1.FileName;

                ServiceExcel miServiceExcel = new ServiceExcel();
                miServiceExcel.InitializeExcel(textBox1.Text);
                dataGridView1.AutoSize = true;


                //listaProductos = miServiceExcel.ReadMyExcel();

                listaTarifas = miServiceExcel.ReadMyExcelTarifas();

                dataGridView1.DataSource = listaTarifas;
            }
            this.button2.Enabled = true;

            /* dataGridView1.Rows.Add(tranList[0]); */
        }