Dale The first drop down combo box for the data grid was written by Mark Boulter and converted to VB by yours truly using Beta1. It's done my heart good to see it appear on the net with a million other authors -- after all plagerism is the most sincere form of flattery :-)
My point is that subclassing the actual control (which I like to think we are pretty good at) doesn't solve the problem. The problem with doing the validation in Current Cell changed (firing the column changed event directly from the presentation) is that this approach works great until you are in a new row. The new row exists in a "detached" state -- it is created by the grid control and does not become a member of the underlying data table until the grid control sends it to the binding/currency manager, who in turn adds the row. In order to fire column changing, you need a pointer to the row passed in the DataColumnChangeEventArgs -- particularly if you have validation where cell A and cell B interact. You can't get at the detached row from CurrentCellChanged because the RowIndex returned by Current Cell does not point to a valid row in the data table on a new row. It's the architecture of the whole data grid/currency manager/data table that causes this problem; hence my desire to implement my own subclassed version of the data grid column style. A data grid text box/drop down/boolean column does not get mated to the grid cell until the grid cell goes into edit mode, and this does not occur until the user actually types something. When the user tabs through the cell, edit mode is never started in the first place. Myself and four other developers have tried just about anything and everything in order to solve this problem to no avail. Sure there are third party grid controls, but at this juncture redesigning literally hundreds of forms to use a new grid does not justify this little feature -- but the end users keep whining. If someone has a direct line to the internals of a data grid column style object then I suspect we could subclass that and change the way that edit mode is invoked but all attempts to date have been a failure because we just don't know enough to sucessfully create a subclassed column style that works -- but I am hopeful that someone on this list who has worked on grid controls can point us in the right direction -- or at least tell me where these guys hang out! Alan Robbins
