Table of Contents
OLE and the Data Control
OLE, or object linking and embedding, and the Data control are two of the the ways Visual Basic can manage data from other applications.
OLE permits sophisticated cutting and pasting of data from one place to another. The Class property of an OLE object determines the type of data that may be represented by the object. An example of an entry in the Class property is "ExcelWorksheet", indicateing the object represents an Excel spreadsheet.
The SourceDoc property links the OLE contgrol with a file that contains the data from the object. The SourceItem property links the OLE control with a subset of the information contained in the SourceDoc file.
The OLETypeAllowed property determines wheter the object displayed on the form is linked or embedded. A linked object maintains a connection from the data displayed in the OLE object to the original data in the original application. The displayed data is sotred in and maintained by the original application that created the data. An embeded object contains the data displayed in teh OLE object and maintains a link to the application that created the object.
If the AutoActive property is set to True, double-clicking on the OLE object on the form starts up the application that creatd the data displayed in the OLE object. The allows the user to modify the information contained in the OLE object.
The Data control, which is included in versions 3 and 4 of Visual Basic, gives a Visual Basic program access to the information contained in database files. Data-aware controls, sucha s the textbox or picture box, link to the Data control and display information fromt eh file to which the Data control is linked. The DatabaseName property of the Data control links the control with a file containing a database.
The Update, AddNew, and Delete mehtods let you control the contents of the database through the copy buffer. The contents of the copy buffer are displayed through the data-aware controls such as the text or picture boxes. When the Update method is executed, any changes made to the copy of the currently displayed record in the copy buffer are written back to the database file. The AddNew method clears the copy buffer and the textboxes of the form and allows the user to enter a new record into the database file. Using the Delete method, a user can remove the currently displayed record from the database file.
Visual Basic supports Structured Query Language, which is a language designed for searching in a database file. Some commonly used parts of the SQL language are the SELECT, FROM, WHERE, and ORDER BY clauses.