Hi guys I am using a for loop to add rows to a datatable after i scan an item. and that item has to be added x number of times.
The problem is that I am using DSHelper to group by one of the fields and if I do two scans one with 11 and one with 22 as the quantity instead of giving me 1 row with a count of 33 it gives me two rows one with 22 grouped together and one with 11 grouped together matching the original datatable.
Here is the for loop.....
I will answer any questions you want if you can offer any help why the grouping is based on the orginal additions i would appreciate the help.
The problem is that I am using DSHelper to group by one of the fields and if I do two scans one with 11 and one with 22 as the quantity instead of giving me 1 row with a count of 33 it gives me two rows one with 22 grouped together and one with 11 grouped together matching the original datatable.
Here is the for loop.....
Code:
for (int i = 0; i < intAddQuantity; i++)
{
DataRow objDR = objDataTable.NewRow();
//The following code adds the data to the table.
objDR["Quantity"] = "1";
objDR["Barcode"] = strScanText;
objDR["Destination"] = strDestination;
objDR["TimeStamp"] = DateTime.Now;
objDR["Manual"] = false;
objDataTable.Rows.Add(objDR);
dataGridViewScan.DataSource = objDataTable;
//Adjust the column widths as required.
dataGridViewScan.Columns["Barcode"].Width = 200;
dataGridViewScan.Columns["TimeSTamp"].Width = 175;
dataGridViewScan.Columns["Destination"].Width = 300;
}
dataGridViewScan.Refresh();
//Clear fields
textBoxScan.Text = "";
textBoxInvoiceNumber.Text = "";
textBoxRowCount.Text = objDataTable.Rows.Count.ToString();
Comment