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:
- View the Form
- Select the Components section in the Toolbox
- Right-Click on the Toolbox, select Customize Toolbox...
- Select the COM Components tab (default)
- Scroll down to
LANSA.MYCOMPand tick the box. - Press OK, a small LANSA icon should appear on the toolbar.
- Drag the icon onto the form, drag out a rectangle and release.
- If the component is a Panel, a blank rectangle of the Panel's size should appear with the name "LANSA.MYCOMP".
- If the component is an Object or a Form, it will appear as an icon at design time.
- 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. - It is now necessary to add this component to the Session. Don't call "Session.CreateComponent", call "Session.AddComponent".
Session.AddComponent(axMYCOMP1.GetOcx()) - A Panel component should now appear "live" when the application is run.
- 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.