Error using Custom Field Property for PictureBox


Author
Message
Chris Diesel
Chris Diesel
StrataFrame User (126 reputation)StrataFrame User (126 reputation)StrataFrame User (126 reputation)StrataFrame User (126 reputation)StrataFrame User (126 reputation)StrataFrame User (126 reputation)StrataFrame User (126 reputation)StrataFrame User (126 reputation)StrataFrame User (126 reputation)
Group: StrataFrame Users
Posts: 74, Visits: 300
I get this error I believe during binding of a Custom Field Property to your PictureBox control.  If I break execution right before the field value is returned, it looks correct.

Error:
    An error occurred while refreshing the data from field 'IwbProduct.PrimaryImage' to property 'Image' on control '.'
Inner Exception:
    Cannot format the value to the desired type.

        
        #region Custom Field Properties

        [Description("Primary Image"), Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
        public byte[] PrimaryImage
        {
            get
            {
                byte[] primaryImage = new byte[0];

                if (this.Count > 0 && this.CurrentRow != null)
                {
                    using (IwbProductImages iwbProductImages = new IwbProductImages())
                    {
                        primaryImage = iwbProductImages.GetPrimaryImage(this.Guid);
                    }
                }

                return primaryImage;
            }
        }

        #endregion

        /// <summary>
        /// Provider property descriptors for the custom bindable fields
        /// </summary>
        protected override MicroFour.StrataFrame.Business.FieldPropertyDescriptor[] GetCustomBindablePropertyDescriptors()
        {
            //-- Return the array of property descriptors
            return new MicroFour.StrataFrame.Business.FieldPropertyDescriptor[] { new ReflectionPropertyDescriptor("PrimaryImage", typeof(IwbProduct)) };
        }




Thanks,
Chris
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