You need to display images from a
Access database in a
Strip the OLE image header that Microsoft Access adds to the image.
The sample code contains six event handlers:
Sets up the sample by filling a
DataTable within a
DataSet with the Categories table from the
Microsoft Access Northwind sample database. The CategoryID,
CategoryName, and Description fields are bound to
TextBox controls. The
BindingManagerBase is obtained for the Categories
table in the
DataSet, a handler is attached to
PositionChanged event, and that handler
is called to position the display on the first record.
PictureBox with the image for the
current record. This event is raised when the
Position property value changes.
The CategoryID for the current record is obtained using the position
information in the
BindingManagerBase object. A
Connection object and
object are created and used to retrieve the
Picture binary field for the category record into
Byte array. A
object is created and the image written into it from the
Byte array using an offset to strip the OLE image
header. The static
FromStream( ) method of the
System.Drawing.Image class is used to load the
image into the
PictureBox from the
Sets the current record of the bound controls to the first record by setting ...