RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.

Tip of the Day
Language: VB5,VB6
Expertise: beginner
Oct 6, 2001



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Let the user insert OLE objects in a RichTextBox control

A little-known feature of the RichTextBox control allows you to insert an OLE object in the text being edited. However, you can do so only programmatically, by adding an element to the OleObjects collection. An easy way to let the user select the object to be embedded in the control is using the InsertObjDlg method of the OLE Container object.

To test this functionality, drop a RichTextBox and an OLE control on a form (leaving their default names), add a cmdInsert button and write this code:

Private Sub cmdInsert_Click()
    ' Show the InsertObject dialog
    If Len(OLE1.Class) Then
        ' If the user selected an object, show it in the RichTextBox control
        RichTextBox1.OLEObjects.Add , , , OLE1.Class
        OLE1.Class = ""
    End If
End Sub

Francesco Balena
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date