I Loaded Data From Datatable to DatagridView which look like this:
SerialNumber1 | Quantity | Issued Quantity | Status |
00001 | 1 | | |
00002 | 2 | | |
I have this requirement which make me stuck .
I need to query The data data grid view records to verify if the loaded Serial Number is The Same as The Actual. (maybe by using linq – correct me if I’m incorrect)
Ex:
var dgviewData = from a in gdview1.AsEnumerable()
where a<string>("SerialNumber").tostring() == txtserial.text
select a;
if(a.Count() > 0 )
{
// Update Status of SerialNumber 00001 to Ok
}
else
{
//Error Serial Not Exist on Gridview
}
If SerialNumbers on DGview is the same on the actual serial scanned , the status will be updated in runtime on datagridview row cell only.
Eg: DGview serial = 00001 —> actual unit scanned = 00001
SerialNumber1 | Quantity | Issued Quantity | Status |
00001 | 1 | 1 | Ok |
00002 | 2 | | |
Thanks in Regards….
Your LINQ query is a bit off, to get matching rows you should do:
Then to update “Issued Quantity” (cell at index = 2) simply do:
Unless you want to increment that number, then use
Int32.Parse/.TryParse.