private void grdItems_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e) { if (e.ColumnIndex == 0) { frmPopUp frmpop = new frmPopUp(true); frmpop.purchase = true; frmpop.ShowDialog(); items.itemid = frmpop.itemid; items.Description = frmpop.desc; //grdsales.Rows[grdsales.CurrentCell.RowIndex].Cells[grdsales.CurrentCell.ColumnIndex].ReadOnly = true; if (items.itemid != null || items.Description != null) { PopClick(); } e.Cancel = true; } else if (e.ColumnIndex == 2) { DataGridViewComboBoxCell column = (DataGridViewComboBoxCell)grdItems.Rows[e.RowIndex].Cells[2]; column.DataSource = units.GetRecord(); column.DisplayMember = "units"; column.ValueMember = "units"; } }
private void grdsales_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e) { if (e.ColumnIndex == 0) { frmPopUp frmpop = new frmPopUp(); frmpop.ShowDialog(); items.itemid = frmpop.itemid; items.Description = frmpop.desc; //grdsales.Rows[grdsales.CurrentCell.RowIndex].Cells[grdsales.CurrentCell.ColumnIndex].ReadOnly = true; if (items.itemid != null || items.Description != null) { PopClick(); } e.Cancel = true; } }