Imbed a Visual LANSA Component on a Visual Basic.NET Form

To embed a VL Panel Reusable Part on a Visual Basic form, or respond to the control's events, it is necessary to place the component using Drag and Drop from the toolbar:

1.  View the Form

2.  Select the Components section in the Toolbox

3.  Right-Click on the Toolbox, select Customize Toolbox...

4.  Select the COM Components tab (default)

5.  Scroll down to LANSA.MYCOMP and tick the box.

6.  Press OK, a small LANSA icon should appear on the toolbar.

7.  Drag the icon onto the form, drag out a rectangle and release.

8.  If the component is a Panel, a blank rectangle of the Panel's size should appear with the name "LANSA.MYCOMP".

9.  If the component is an Object or a Form, it will appear as an icon at design time.

10. A component will have been automatically defined and the creation code added in your Visual Basic form after the drag drop. The default name will be axMYCOMP1.

11. It is now necessary to add this component to the Session. Don't call "Session.CreateComponent", call "Session.AddComponent".

Session.AddComponent(axMYCOMP1.GetOcx())

12. A Panel component should now appear "live" when the application is run.

13. Until ShowForm is called, an Object will not appear and a Form will not appear.

     The component's methods, properties AND events are now accessible to Visual Basic.