Beispiel #1
0
        private void prepararForma()
        {
            if (txtBuscar.Text.Trim() == "")
            {
                DS = ct1_productos.leerProductos();
            }
            else
            {
                DS = ct1_productos.leerProductos(txtBuscar.Text);
            }
            dataGridView1.DataSource = DS.Tables[0];

            foreach (DataGridViewColumn col in dataGridView1.Columns)
            {
                col.HeaderText = col.HeaderText.Substring(0, 1).ToUpper() + col.HeaderText.Substring(1);
            }

            Font negrita = new Font(this.Font, FontStyle.Bold);

            dataGridView1.ColumnHeadersDefaultCellStyle.Font = negrita;

            //dataGridView1.Columns["precio_unitario"].DefaultCellStyle.Alignment =
            //dataGridView1.Columns["existencia"].DefaultCellStyle.Alignment =
            // dataGridView1.Columns["p_reorden"].DefaultCellStyle.Alignment =
            // DataGridViewContentAlignment.MiddleRight;
            //dataGridView1.Columns["precio_unitario"].DefaultCellStyle.Format = "c";
            //dataGridView1.Columns["precio_unitario"].HeaderText = "P_unit";
            //dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
            //dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
            dataGridView1.MultiSelect       = false;
            dataGridView1.RowHeadersVisible = false;
            DS = null;
            //if (this.Visible)
            // coloreadatagridview();
        }