I am working on a simple purchase order system in VB.NET 2003
I have a dataset that has a purchase order header (purchtable) and the purchase order lines. (purchlines), joined on purchase Order number.
My form has 2 datagrids.
The top datagrid is connected to purchtable, and shows a list of purchase orders.
The bottom datagrid is connected to purchlines and shows the related lines of the purchase order.
When you click on a purchase order in the top grid, the lines of the purchase order automatically show in the bottom grid.
One of the fields in the purchase order line is an item number (ie Inventory Part number) . (My system has another table of valid items that can be purchased.)
So, when the user keys in an item number, I want to validate the item number against the valid items table. If it is not valid, I want to issue an error message (via msgbox, or .SetColumnError or something)
The solution MUST cover the following situations;
The validation must occur when the user moves off the cell containing the item number. (either via mouse or keyboard) .
If the field is in error, the user must not be able to move to another row in the grid or move the focus to any other part of the form (especially moving to another order by clicking on the order grid). Also the user must not be able to close the form with the item in error.
The cursor should be placed back on the item field in error.
The solution must cover the situation where the users moves to the end of the orderlines grid (creating a new record), and enters an invalid item.
Obviously I can do the actual item # validation code. My question is more about the events (cellchanged, column changing) etc etc. I just can't work it out.