D
Debra has a question
Guest
I have a datagridview which gets loaded on the page load. I noticed a few interesting problems with the datagridview. When the datagridview loads it selects the first row by default and when I select a different row it goes through the cellbeginedit event:
private void dgvPurchaseOrderToReceive_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
{
if (loadingDataGridView) return;
if (e.ColumnIndex == 0 && e.RowIndex > -1 && (bool)dgvPurchaseOrderToReceive.Rows[dgvPurchaseOrderToReceive.CurrentCell.RowIndex].Cells[0].FormattedValue == false)
{
if (receivedAmount == Convert.ToInt32(dgvPurchaseOrderToReceive.CurrentRow.Cells["Received"].Value))
{
e.Cancel = true;
Validation.ShowMessage(Main.lblStatus, "Item already fully received!");
}
}
}
It says "Item already fully received even though its not true the row that we left was fully received not the row we are coming into.
But even though I didnt select the first column when debugging it thinks the first column first row is being selected. This only happens the first time the datagridview loads after that it all works fine. What can I do about it?
Also, when on the form closed event I check if any of the datagridview checkboxes are checked it should give a message "Would you like to save before closing." Which works nicely except when I check something off and dont yet do any other event just x the screen it doesnt yet realize that there is a row checked in the datagridview.select("checked = true")
Debra has a question
Continue reading...
private void dgvPurchaseOrderToReceive_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
{
if (loadingDataGridView) return;
if (e.ColumnIndex == 0 && e.RowIndex > -1 && (bool)dgvPurchaseOrderToReceive.Rows[dgvPurchaseOrderToReceive.CurrentCell.RowIndex].Cells[0].FormattedValue == false)
{
if (receivedAmount == Convert.ToInt32(dgvPurchaseOrderToReceive.CurrentRow.Cells["Received"].Value))
{
e.Cancel = true;
Validation.ShowMessage(Main.lblStatus, "Item already fully received!");
}
}
}
It says "Item already fully received even though its not true the row that we left was fully received not the row we are coming into.
But even though I didnt select the first column when debugging it thinks the first column first row is being selected. This only happens the first time the datagridview loads after that it all works fine. What can I do about it?
Also, when on the form closed event I check if any of the datagridview checkboxes are checked it should give a message "Would you like to save before closing." Which works nicely except when I check something off and dont yet do any other event just x the screen it doesnt yet realize that there is a row checked in the datagridview.select("checked = true")
Debra has a question
Continue reading...