Override Property Setter


Author
Message
Ben Kim
Ben Kim
StrataFrame User (133 reputation)StrataFrame User (133 reputation)StrataFrame User (133 reputation)StrataFrame User (133 reputation)StrataFrame User (133 reputation)StrataFrame User (133 reputation)StrataFrame User (133 reputation)StrataFrame User (133 reputation)StrataFrame User (133 reputation)
Group: Forum Members
Posts: 99, Visits: 253
Yes.  However I had issues after doing so.  The editing state of the form seemed to screw up and the lookup did not happen at all when I moved my code to the "property setter/getter" area.

I reverted my code back to the original form...  Handle trimming/padding in the CheckRulesOnCurrentRow, and all calls to lookup descriptions for "codes" are done back in the Maintenance Form now.  All is well now... No more "EditingState" errors ;-)

Ben

Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.5K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
Do you put the entire property statement in the custom code box (i.e. Public Property MyField() As Integer...etc.)? Or just get/set statements?
StrataFrame Team
S
StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
You can customize the field through the BOMapper and paste your code into the custom code field.  Then, when the partial class is built, the BOMapper will spit out the custom code rather than the generated code for that property.  You can also choose custom code and just put a comment or a couple line breaks in the custom code box and just put your property in the main code file.
Ben Kim
Ben Kim
StrataFrame User (133 reputation)StrataFrame User (133 reputation)StrataFrame User (133 reputation)StrataFrame User (133 reputation)StrataFrame User (133 reputation)StrataFrame User (133 reputation)StrataFrame User (133 reputation)StrataFrame User (133 reputation)StrataFrame User (133 reputation)
Group: Forum Members
Posts: 99, Visits: 253
Hello all,

Is there a way to override a BO property Setter?  I have tried copying the Property I want to modify into the BO.vb (not the designer file) and apply Overrides to the public property method.  This of course does not compile since the base property is not overridable.

What I would like to do is if a value is changed, automatically UPPERCASE and PadLeft(3) the field, plus call a function to set another field:

Example Setter:

Me.CurrentRow.Item("HairColor") = value.ToUpper.PadLeft(3)
Me.HairColorDescription = GetLookupItem(DepartmentID, TableNumber, Me.CurrentRow.Item("HairColor"))

My initial thought was to UpperCase and Pad the field in the CheckRulesOnCurrentRow event.

Me.HairColor = Me.HairColor.ToUpper.PadLeft(3) !Pad left for sorting purposes
Me.HairColorDescription = GetLookupItem(DepartmentID, TableNumber, Me.HairColor)

The above works.  However as I navigate through the records (even after copying the code to the BO Navigated event), the description seems to always be one behind the current record.  Custom fields and property descriptions have been setup and work so this is not the issue either.

Ideas?

Thanks!

Ben

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search