VB.NET Code to Implement a Child Collection Item

Back to Implementing the Collection Item
Imports System.Drawing Imports System.IO Public Class ProductImageEntity Inherits EPS.Business.BusinessObjects.EntitySubItemCollectionItem Public Sub New(ByVal parentCollection As IEntitySubItemCollection) MyBase.New(parentCollection) End Sub Public Property Label() As String Get Return CType(Me.GetFieldValue("clabel"), String) End Get Set(ByVal Value As String) Me.SetFieldValue("clabel", Value) End Set End Property Public Property Image() As Bitmap Get If Me.GetFieldValue("iimage").ToString() = "" Then Return Nothing End If Dim bmpFile As Bitmap = Nothing Try Dim stmFile As New MemoryStream Dim objWriter As New BinaryWriter(stmFile) objWriter.Write(CType(Me.GetFieldValue("iimage"), Byte())) bmpFile = New Bitmap(stmFile) Catch bmpFile = Nothing End Try Return bmpFile End Get Set(ByVal Value As Bitmap) Dim stmFile As New MemoryStream Value.Save(stmFile, System.Drawing.Imaging.ImageFormat.Jpeg) Me.SetFieldValue("iimage", stmFile.ToArray) End Set End Property End Class

Back to Implementing the Collection Item


Last Updated: 8/10/2006