Fixing Errors in Sample


Author
Message
Terry Bottorff
Terry Bottorff
Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)
Group: Forum Members
Posts: 448, Visits: 12K
This is the error in the CRM Sample App:

Error 1 Value of type '1-dimensional array of Byte' cannot be converted to 'System.Drawing.Image'. C:\Program Files\MicroFour\StrataFrame\VB.NET Samples\CRMApplication\SampleCRMApplication\Forms\OrderItemEntry.vb 37 33 SampleCRMApplication

This is the line:

Me.picPhoto.Image = Me.ProductsTemp.prod_Image

What should I try? TIA.

 


Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Well, this is a data issue not an application issue.  We noticed, recently in fact, that our distribution image data for the sample data had been overwritten, thus, there is not an image which is ties to the product any longer.  You can attach an image to the record then save, or create a new record and attach an image, and it should update properly.

All we are trying to show here is how a BO can serialize an image into a byte array and retrieve from the database without any coding on the side of the developer.

Terry Bottorff
Terry Bottorff
Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)
Group: Forum Members
Posts: 448, Visits: 12K
There are several of these errors. Do I need to use a different image for each one of them? Also, does it require a special type of image and where will I save them?
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
I just ran the sample of a fresh install without issue.  How are you producing this error?
Terry Bottorff
Terry Bottorff
Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)
Group: Forum Members
Posts: 448, Visits: 12K
I just went to the menu VS -> Found the CRM example-> Loaded it -> Did a build on project .

StrataFrame Team
S
StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Hrm, it could be that the business objects being used by the CRM sample are not correct.  The prod_Image field is supposed to be a serialized System.Drawing.Bitmap, not a raw byte[].  It's supposed to look like this:

Public Property [prod_Image]() As System.Drawing.Bitmap
        Get
            Try
                Return CType(Me.BinaryFormatter.Deserialize(New MemoryStream(CType(CurrentRow.Item("prod_Image"), Byte()))), System.Drawing.Bitmap)
            Catch
                Return Nothing
            End Try
        End Get
        Set(ByVal value As System.Drawing.Bitmap)
            Dim loStream As New MemoryStream()
            Me.BinaryFormatter.Serialize(loStream, value)
            Me.CurrentRow.Item("prod_Image") = loStream.ToArray()
        End Set
    End Property

So, paste that code over the prod_Image property and it should build properly.

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