Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.
cell validation - beforeUpdate or poschanging?
I've historically used poschanging for any cell validation, which works well by the way (certainly far better than poschanged) but I'm looking at the beforeUpdate event and can't quite grasp which would be the recommended event for validating user input.
I suspect I've always used poschanging because I was used to poschanged and this was an improvement over those flaws.
I feel like I've been down the beforeUpdate path previously but can't remember why I wouldn't stick with it. From the description it seems like the place to validate but I also feel like I'm missing something.
I suspect I've always used poschanging because I was used to poschanged and this was an improvement over those flaws.
I feel like I've been down the beforeUpdate path previously but can't remember why I wouldn't stick with it. From the description it seems like the place to validate but I also feel like I'm missing something.
Comments
That said, I did try it just before penning this post. I wanted a simple validation; a quantity column to contain a number so I set the cellconv validation property to "MDO".
Regardless of what I entered in the cell, the invaliddata message just kept popping up, so I thought I'd just revert back to old habits but with a view to changing the event if appropriate.
If not, then I still suggest you use the BeforeUpdate event as your next best option. Likewise, the AfterUpdate event is what you should use for formatting the data. OnPoschanging should only be used to prevent navigation based on business rules. OnPoschanged is helpful for implementing a default value in the cell getting focus.
With that guidance I revisited the cellconv and set it to skip the message and fire the OnInvalidData event so I could capture what it was working with. I assume I'm overlooking something simple but here's what the debugger shows me
P2 looks like a number to me but I must have my blinkers on
cellValidation = "MD24" cellConversion = null$ cellValidMsg = "Quantity must be a number" showMessage = false$ Set_Property(ole_itemTable$, "OLE.CellConv[":QtyCol$:"; All]", cellValidation:fm$:cellConversion:fm$:cellValidMsg:fm$:showMessage)
What version of SRPControls.ocx are you using?
With or without a conversion value.
4.0.3
I can manage it with the beforeupdate event but curious that it doesn't seem to work for me. It doesn't look that difficult to implement