StrataFrame Forum

Db Int field won't populate in my textbox

http://forum.strataframe.net/Topic1555.aspx

By Andria Jensen - 6/15/2006

I have a wrapped DevEx textbox on my form, linked to a business object.  This textbox has a BindingField that is an Integer, and it needs to populate on selection of a grid row.  When I try to populate this textbox I get the following exception:

An error occurred while refreshing the data from field 'ChkSourceBO.3' to property 'Text' on control 'fldIncrement.'  Are you missing FieldPropertyDescriptor for a custom property?

I figure this is some kind of conversion or formatting thing trying to go from an integer to a string.  Am I missing anything here?  Why is my field showing as ChkSourceBO.3 when the field is ChkSourceBO.FloatIncr?  The value it's trying to populate is 3...not sure what that's about.  Any ideas?

 

By Trent L. Taylor - 6/16/2006

Andria,

The field you are binding to does not have a field property descriptor associated with it which is generally created through the BO Mapper.  I assume you created a custom property and then attempted to bind to that property.  This can be done, but requires a field property descriptor to prevent .NET from using reflection during the binding process.

In the business object 'ChkSourceBO' you will need to add the following code:

Imports
Imports MicroFour.StrataFrame.Business
Imports System.ComponentModel
Imports System.ComponentModel.Design
Imports MicroFour.StrataFrame.UI.Windows.Forms

Code Overrides in the ChkSourceBO.vb file
Protected Overrides Function GetCustomBindablePropertyDescriptors() _
     As MicroFour.StrataFrame.Business.FieldPropertyDescriptor()
        Return New FieldPropertyDescriptor() _
         {New ReflectionPropertyDescriptor("3", GetType(ChkSourceBO))}
End Function

There is additional information on this in the help documentation.  You can locate the article at:

Contents -> Business Layer -> Adding Custom Field Properties

Hope this helps. Smile

P.S. This should have nothing to do with the DevExpress textbox and should behave the same way with a standard SF textbox.