Reputation: 3760
I am having two DataGridView
controls in two different tabs of C# Winforms Application, with Visual Studio 2019.
First Grid contains Itemname and Price as following
ITEMNAME PRICE
---------------------
MOUSE 399.00
PRINTER 12000.00
MONITOR 18500.00
In another grid, I display these items issued/sold to different customers as below
CUSTOMERNAME ITEMNAME PRICE
-----------------------------------------
ANANT H MOUSE 399.00
JOLLY K MONITOR 18500.00
ANANT H MOUSE 399.00
KIRAN A PRINTER 12000.00
KIRAN A MOUSE 399.00
When price is updated of any item in first grid, I want that to be reflected in second grid against the matching itemname.For example, if MOUSE price is change to 500.00, it should reflect immediately in all 3 cells of PRICE column of second grid, where ITEMNAME matches.
Obvious choice of doing this, is to run a for loop and match with ITEMNAME and get the PRICE cell to edit the value. But this looks heavy and time consuming to me when large number of records are there in second grid.
Is there any idea with which I can change all the value of matching ITEMNAME's PRICE value at once, when it's price changes in first grid?
Like we do in EXCEL where if cells are referenced to a single master cell, when we change master cell price value, all the referenced cell values are automatically changed at once.
Upvotes: 0
Views: 222
Reputation: 74595
Ok, so we can do this with data relations:
Parent.Price
Run the app, put some products in, then put a quote in, then change the price. It should update automatically The quote
Upvotes: 1