B
Bryan Valencia
Guest
Visual Studio 2019
Winforms app
.net framework 4.5
I am creating a row in a datagridview in code. Here is the relevant snippet.
DataRowView newRow=(DataRowView)fKPurchaseOrderDetailPurchaseOrderBindingSource.AddNew();
newRow["Customer"] = this.Customer;
newRow["Purchase_Order_No"] = this.PO;
newRow["Production_No"] = calcNewProdNo();
newRow["ProductionNoDueDate"] = nDTPDueDate.Value;
newRow["sType"] = sTypeTextBox.Text;
newRow["Plant"] = "1812"; //THIS DOES NOT WORK
This is a DETAIL data grid (hence fkPurchase...)
Customer and Purchase_Order_No are the foreign key.
After those, Production_No completes the primary key of the details table.
All these lines work until I hit "Plant". Plant is a DataGridViewComboBoxColumn.
When creating a new row with the code above, nothing throws an exception, but the Plant is not set. I have tried setting it to the value and display members of the dropdown list to no avail. What am I missing?
I'd rather live with false hope than with false despair.
Continue reading...
Winforms app
.net framework 4.5
I am creating a row in a datagridview in code. Here is the relevant snippet.
DataRowView newRow=(DataRowView)fKPurchaseOrderDetailPurchaseOrderBindingSource.AddNew();
newRow["Customer"] = this.Customer;
newRow["Purchase_Order_No"] = this.PO;
newRow["Production_No"] = calcNewProdNo();
newRow["ProductionNoDueDate"] = nDTPDueDate.Value;
newRow["sType"] = sTypeTextBox.Text;
newRow["Plant"] = "1812"; //THIS DOES NOT WORK
This is a DETAIL data grid (hence fkPurchase...)
Customer and Purchase_Order_No are the foreign key.
After those, Production_No completes the primary key of the details table.
All these lines work until I hit "Plant". Plant is a DataGridViewComboBoxColumn.
When creating a new row with the code above, nothing throws an exception, but the Plant is not set. I have tried setting it to the value and display members of the dropdown list to no avail. What am I missing?
I'd rather live with false hope than with false despair.
Continue reading...