Object Linking and Embedding

Snoops

   

 
Migrating to .NET: A Pragmatic Path to Visual Basic .NET, Visual C++ .NET, and ASP.NET
By Dhananjay  Katre, Prashant  Halari, Narayana  Rao  Surapaneni, Manu  Gupta, Meghana  Deshpande

Table of Contents
Chapter 4.   Post-migration Changes


An OLE container is used in Visual Basic 6.0 to communicate and also execute the functionality of OLE-compliant applications such as Microsoft Word and Excel. In Visual Basic 6.0, we can use the OLE container control to link to a specific document, or the document can be embedded completely in the OLE container control. The following explains the difference between the two:

Linked Object

  1. In the linked document, changes made to the document update the original document.

  2. When the document is linked, the document's application (Excel, Word, etc.) is started before any editing can be done.

Embedded Object

  1. Changes made to the embedded document do not update the original document.

  2. The embedded document can be edited inline in the Visual Basic application. The document's application (Word or Excel) is not started.

Visual Basic .NET does not support OLE applications. If the upgrade wizard is used to upgrade OLE applications, the upgrade report will contain several errors and warnings specific to the OLE part of the application.

WebBrowser Control

There is no OLE container control in Visual Basic .NET. If functionality of the OLE container control is needed in Visual Basic .NET, in some cases the developer can substitute the Visual Basic 6.0 WebBrowser ActiveX control and use it as an OLE container. However, this control does not provide all the powerful capabilities of the OLE container control.

In testing, it has been found that the WebBrowser can open the Excel or Word document in the Visual Basic application. All functionalities of Word and Excel are available. However, the menus of the Word and the Excel applications do not appear on the Web browser control (as they appear on the OLE container control). Only the shortcut keys provide the functionalities of Word and Excel.

In the WebBrowser control, the following code has to be written to open the desired file:

 WebBrowser1.Navigate("E:\Personal\Excel\Contacts.xls") 

The original file is opened as in the case of a linked object. However, only inline editing of the document is allowed. Any changes made in the Visual Basic screen will be updated in the original file. However, like the OLE container control, the menus of the document's application (Word, Excel, etc.) do not appear.


Snoops

   
Top


Migrating to. NET. A Pragmatic Path to Visual Basic. NET, Visual C++. NET, and ASP. NET
Migrating to. NET. A Pragmatic Path to Visual Basic. NET, Visual C++. NET, and ASP. NET
ISBN: 131009621
EAN: N/A
Year: 2001
Pages: 149

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net