Exemplo n.º 1
0
        private void ShowDataInDataGridView(string sql, DataGridViewEx mydgv, string wherestr, string sqlstr)
        {
            mydgv.SetDataGridViewTheme2(true, false, "No", true, true, 32, 22, true, false, false);
            mydgv.DefaultCellStyle        = DataCellStyle1;
            mydgv.AllowUserToOrderColumns = false;
            //mydgv.AllowUserToResizeColumns = false;
            mydgv.AllowUserToResizeRows = false;

            DataTable dt = cs.GetDataTable(sql, wherestr, sqlstr);

            this.bindingSource1.DataSource = dt;
            mydgv.DataSource  = null;
            mydgv.DataSource  = this.bindingSource1;
            mydgv.CurrentCell = null;
            if (this.rdtable6.Checked)
            {
                dt.TableName = "AdjustQty";
                mydgv.Columns["KeyID"].ReadOnly     = true;
                mydgv.Columns["Code"].ReadOnly      = true;
                mydgv.Columns["InputTime"].ReadOnly = true;
                mydgv.Columns["UserID"].ReadOnly    = true;
                mydgv.Columns["KeyID"].Visible      = false;
                mydgv.Columns["Code"].Visible       = false;
                mydgv.Columns["InputTime"].Visible  = false;
                mydgv.Columns["UserID"].Visible     = false;
            }
        }
Exemplo n.º 2
0
        private void ShowDataInDataGridView(string sql, DataGridViewEx mydgv)
        {
            mydgv.SetDataGridViewTheme2(true, false, "No", false, false, 32, 25, true, false, false);
            mydgv.DefaultCellStyle         = DataCellStyle1;
            mydgv.AllowUserToOrderColumns  = false;
            mydgv.AllowUserToResizeColumns = false;
            mydgv.AllowUserToResizeRows    = false;
            mydgv.ReadOnly = true;

            DataTable dt = db.GetDataTable(sql);

            mydgv.DataSource  = null;
            mydgv.DataSource  = dt.DefaultView;
            mydgv.CurrentCell = null;
        }