HOWTO: Use the Picture Box in a UserControl and in a DataRepeater Control 
SUMMARY
This article demonstrates how to display a picture from a database in a picture box in a UserControl and in the Microsoft DataRepeater control. MORE INFORMATION
When you bind a UserControl or DataRepeater control that contains a Picture Box, set the DataFormat of the bound picture box to Picture.NOTE: To bind a picture to a field in a database, the field must be stored without the header and footer information of a Microsoft Access OLE field. An Access OLE field that contains a bitmap also contains header and footer information, which prevents binding a picture box to the field. Sample Code
To create this sample project you must: 
Create a sample database. 
Create the UserControl. 
Create the test project. 
Create a Sample Database
The following project creates a Microsoft Access 2000 database and a table in the database. It then populates the table with a record that contains a Picture object from your Windows directory. The picture is inserted as binary data, not as an Access OLE field.Note that you only have to run this project once to create the database.
In Visual Basic, create a new Standard EXE project. Form1 is created by default.
From the Project menu, select References.
In the list of available references, select the following:
Microsoft ActiveX Data Objects Library 
Microsoft ADO Ext. for DDL and Security Paste the following code into the code window of Form1's Form_Load Event:'This code creates an Access 2000 database named C:\Picture.mdb.
'It then creates a table within the .mdb named PicTable with two fields
'one named Picture and the other named Description.
'Finally, it loads one record into the table.   'Create a new Access 2000 database.
   Dim cat As ADOX.Catalog
   Set cat = New ADOX.Catalog
   cat.Create "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Picture.mdb"
   
   'Create a new table in the new Access 2000 database.
   Dim tbl As ADOX.Table
   Set tbl = New ADOX.Table
   tbl.Name = "PicTable"
   tbl.Columns.Append "Picture", adLongVarBinary
   tbl.Columns.Append "Description", adVarWChar, 50
   cat.Tables.Append tbl   'Open the new table.
   Dim RS As ADODB.Recordset
   Set RS = New ADODB.Recordset
   RS.CursorLocation = adUseClient
   RS.Open "Select * from PicTable","Provider=Microsoft.Jet.OLEDB.4.0;" & _
           "Data Source=C:\Picture.mdb", adOpenStatic, adLockOptimistic   'Check the following paths and make sure there is a valid path to the .bmp files.
   Dim MyArray() As Byte
   'If you use Windows 95 or Windows 98 then use This Line
   Open "C:\Windows\Bubbles.bmp" For Binary As #1
   'If you use Windows NT then use this line
   'Open "C:\Winnt\Blue Monday.bmp" For Binary As #1
   ReDim MyArray(LOF(1))
   Get #1, , MyArray()
   Close #1   'Add a Record containing a Picture to the new table.
   RS.AddNew
   RS(0).AppendChunk MyArray()
   RS(1) = "This is Picture 1"
   RS.Update   'Clean up
   RS.Close
   Set RS = Nothing
   Set tbl = Nothing
   Set cat = Nothing 
If you are running on Microsoft Windows NT, comment out the line: 
Open "C:\Windows\Bubbles.bmp" For Binary As #1
and uncomment the line: 
'Open "C:\Winnt\Blue Monday.bmp" For Binary As #1
If needed, further modify the path to the Bubbles.bmp file or the Blue Monday.bmp file to the folders on your system.
Run this code once.You should now have a new Access 2000 Database that has one record in it.
Exit Visual Basic.
Create the UserControl
In Visual Basic, create a new ActiveX control project. UserControl1 is created by default.
Right-click the UserControl1 and then select Properties. Change the text in the Name property of UserControl1 to MyUserControl.
Place a PictureBox control onto MyUserControl. Change the PictureBox's Name property to MyPicture.
Place a TextBox control onto MyUserControl. Change the TextBox's Name property to MyText.
From the Add-Ins menu, select Add-In Manager. From the list of available add-ins, select:
VB 6 ActiveX Ctrl Interface Wizard.
Clear the Loaded/Unloaded check box and then click OK. 
From the Add-Ins menu, select the ActiveX Control Interface Wizard..
In the Introduction dialog box of the ActiveX Control Interface Wizard, select Next.
In the Select Interface Members dialog box, click << to clear the list of names, and then click Next.
In the Create Custom Interface Members dialog box, click New.
In the Name text box, type MyPictureData. Note that this is a property. 
Click OK.
In the Create Custom Interface Members dialog box, click New.
In the Name text box, type MyPictureText.Note that this is a property. 
Click OK and then click Next.
In the Set Mapping dialog box, select MyPictureData from the list of Public Names.
In the Maps to Control list, select MyPicture.
In the Member list, select Picture.
Select MyPictureText from the list of Public Names.
In the Maps to Control list, select MyText.
In the Member list, select Text.
Click Next and then click Finish.
In the Summary dialog box, click Close.The code created by the ActiveX Control Interface Wizard should look like the following: 'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MappingInfo=MyPicture,MyPicture,-1,Picture
Public Property Get MyPictureData() As Picture
    Set MyPictureData = MyPicture.Picture
End PropertyPublic Property Set MyPictureData(ByVal New_MyPictureData As Picture)
    Set MyPicture.Picture = New_MyPictureData
    PropertyChanged "MyPictureData"
End Property'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MappingInfo=MyText,MyText,-1,Text
Public Property Get MyPictureText() As String
    MyPictureText = MyText.Text
End PropertyPublic Property Let MyPictureText(ByVal New_MyPictureText As String)
    MyText.Text() = New_MyPictureText
    PropertyChanged "MyPictureText"
End Property'Load property values from storage
Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
    Set Picture = PropBag.ReadProperty("MyPictureData", Nothing)
    MyText.Text = PropBag.ReadProperty("MyPictureText", "Text1")
End Sub'Write property values to storage
Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
    Call PropBag.WriteProperty("MyPictureData", Picture, Nothing)
    Call PropBag.WriteProperty("MyPictureText", MyText.Text, "Text1")
End Sub 
On the Tools menu, select Procedure Attributes.
Select MyPictureData in the Name list. Click Advanced.
In the Data Binding area, select the Property Is Data Bound check box.
Select the Show DataBindings Collection At Design Time check box.
Select MyPictureText in the Name list. Select the Property Is Data Bound and Show DataBindings Collection At Design Time check boxes again. 
Click Apply.
Click OK.
On the File menu, select Make Project1.ocx. Change the file name to MyUserControl.ocx, and then click OK.NOTE: Do not exit Visual Basic, because you need to add a test project. 
Create the Test Project
On the File menu, select Add Project. Create a new Standard EXE project. Form1 is created by default.
On the Project menu, select Components. From the list of available Components, select the following:
Microsoft ADO Data Control (OLE DB) 
Microsoft DataRepeater Control (OLE DB) to the tool bar. 
Add a ADO DataControl to Form1. ADODC1 is created by default.
Set the ConnectionString property of ADODC1 to the Pictures database created previously, using Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Picture.mdb.
Set the RecordSource property of ADODC1 to the PicTable table.
Add a DataRepeater control to the form. DataRepeater1 is created by default.
Set the DataSource of DataRepeater1 to ADODC1.
Select the RepeatedControlName property. From the list of available controls, select MyUserControl.UserControl1.
Select the Custom property. Click the ellipsis (...) button to open the Property dialog box.
In the Property dialog box, select the RepeaterBindings tab. From the list of PropertyNames, select MyPictureData. From the list of DataFields, select Picture and then click Add.
Select the Format tab. From the list of Format Items, select MyPictureData. For the Format Type, select Picture.
Again, select the RepeaterBindings tab. From the list of PropertyNames, select MyPictureText. From the list of DataFields, select Text and then click Add. Click Apply and then click OK.
In the Project Explorer, select the test project. Right-click the test project and then select Set as Startup.
Run the project. There should be a picture and a description in the control.