﻿<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>StrataFrame Forum » StrataFrame Application Framework - V1 » WinForms (How do I?)  » Best Practice for Implementing Field Level Business Rules</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Tue, 09 Jun 2026 20:53:12 GMT</lastBuildDate><ttl>20</ttl><item><title>Best Practice for Implementing Field Level Business Rules</title><link>http://forum.strataframe.net/FindPost4007.aspx</link><description>I'd like to provide my users with an error message if they enter an invalid value into a bound control and also prevent them from leaving that control until the entry is corrected.&amp;nbsp; I'd like to keep all of the business rules in the business object rather than in the control's Validating event.&amp;nbsp; Do you guys have any guidance as to how this can best be accomplished?&lt;/P&gt;&lt;P&gt;Another common situation for us is that the entry of one field will cause one or more other fields to change their value.&amp;nbsp; Is having the business object sink its own FieldPropertyChanged event the best way to handle that?&lt;/P&gt;&lt;P&gt;Thanks for your help.&lt;/P&gt;&lt;P&gt;Fran Parker&lt;/P&gt;&lt;P&gt;MaxQ Technologies, Inc.</description><pubDate>Tue, 31 Oct 2006 14:30:48 GMT</pubDate><dc:creator>fparker</dc:creator></item><item><title>RE: Best Practice for Implementing Field Level Business Rules</title><link>http://forum.strataframe.net/FindPost4008.aspx</link><description>[quote]I'd like to keep all of the business rules in the business object rather than in the control's Validating event.&amp;nbsp; Do you guys have any guidance as to how this can best be accomplished?[/quote] &lt;P&gt;This kindof becomes a "sticky wicket" when you start trying to do this.&amp;nbsp; The only way to prevent forward (or backward) navigation in a text box is in the validating event.&amp;nbsp; You can prevent records from being saved, navigated, etc.&amp;nbsp; But the only option .NET even provides in this arena is the validating event.&amp;nbsp; If this type of entry can be avoided, then this is my recommendation.&amp;nbsp; This is what we used to do in our medical system and this is where we got the most complaints.&amp;nbsp; Our users despised it because they would either get stuck or they would keep clicking save and get another error no knowing where the end was.&amp;nbsp; Sorry :ermm: no great revelations here for you.&lt;/P&gt;&lt;P&gt;[quote]Is having the business object sink its own FieldPropertyChanged event the best way to handle that?[/quote]&lt;/P&gt;&lt;P&gt;You can go either way here.&amp;nbsp; Generally, standards indicate that if you are changing values on a form, you set the form controls.&amp;nbsp; But if you are changing data, you change the BO field properties.&amp;nbsp; But it really doesn't matter.&amp;nbsp; If you change the field properties of the BO, you may need to call the Refresh of the BO to reflect the changes made to the data:&lt;/P&gt;&lt;P&gt;MyBO.Refresh("MyFieldName")</description><pubDate>Tue, 31 Oct 2006 14:30:48 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item></channel></rss>