Exemple #1
0
        private void ConfigureGridColumns()
        {
            DataGridViewColumnCollection columns = itemsGrid.Columns;

            columns[0].Visible = false;

            columns[1].HeaderText = "Item Name";
            columns[1].Width      = 230;

            columns.RemoveAt(2);

            DataGridViewComboBoxColumn column = new DataGridViewComboBoxColumn();

            column.DataPropertyName = "UoMID";
            column.DataSource       = unitsTable;
            column.DisplayMember    = "UnitName";
            column.ValueMember      = "ID";
            column.ValueType        = SqlDbType.Int.GetType();
            column.Width            = 120;
            column.Name             = "UoMID";
            column.HeaderText       = "Measurement Unit";
            column.DisplayStyleForCurrentCellOnly = true;

            columns.Insert(2, column);

            DataGridViewTextBoxColumn textColumn = (DataGridViewTextBoxColumn)columns[3];

            textColumn.HeaderText = "Price Per Unit (Rs.)";
            textColumn.Width      = 120;
            textColumn.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
            textColumn.DefaultCellStyle.Format    = "N2";
        }
 public override void RemoveAt(int index)
 {
     _base.RemoveAt(index);
 }