Skip to main content Skip to complementary content

Using QlikView OCX component from Visual Basic

Including the control in a VB.NET project

The QlikView OCX control must first be included in the Visual Basic project. This is done as follows:

  1. Right-click on the toolbox in Visual Basic.
  2. Select Components on the Context menu.
  3. Scroll down the list until you find QlikView OCX ActiveX control module. If it does not appear in the list, the QlikView OCX control has not been properly registered
  4. Copying and registering the QlikView OCX component

  5. Select that component by checking the check box to the left of it.
  6. Click OK. A QlikView icon should now appear in the toolbox.

Placing a QlikView OCX control on a VB form

You may now include the QlikView OCX control on a form in your VB project.

  1. Click the QlikView icon in the toolbox.
  2. Use the mouse to mark the size and position of the QlikView OCX control on the form.
Information noteAt the moment only one QlikView OCX control may be used in one project.

Accessing the QlikView OCXcontrol from VB code

Once the component has been included and placed on a form it may be referenced as an object by the name QlikOCX1.

The active QlikView document can be referenced as QlikOCX1.ActiveDocument.

In addition to the QlikView OCX specific Automation members, almost all members of the standard QlikView Automation interface may be used for control of the OCX component. See the QlikView Automation Reference manual for details.

Note that in cases where member names are shared between the general QlikView Automation interface and the QlikView OCX specific Automation interface, the latter will have preference. The actual difference is however negligible.

Examples:


Private Sub Command1_Click()
			QlikOCX1.OpenDocument "C:\MyDoc", "", ""
End Sub

Private Sub Command2_Click()
	QlikOCX1.ActiveDocument.Reload
End Sub
		

Useful VB support modules

If you need to use QlikViewinternal constant definitions, include the module file qvmenu.bas to your project. The file which can be found in the \Runtime library\Resources\Vb directory installed by the QlikView OCX SDK Package contains QlikViewinternal menu constant definitions. This file will be updated together with the OCX control.

If you plan to manipulate the QlikViewobject menus the module file MenuDef.bas may be quite useful. It contains declarations of system calls for manipulating menus.


Rem MenuDef.bas
Public Const MF_SEPARATOR = 2048
Public Const MF_STRING = 0
Declare Sub AppendMenu Lib "user32" Alias
"AppendMenuA" (ByVal _
hMenu As Long, ByVal uFlags As Long, ByVal uIDNewItem
As Long, _
ByVal lpNewItem As String)
Public Const MF_BYCOMMAND = 0
Public Const MF_BYPOSITION = 1024
Declare Sub DeleteMenu Lib "user32" (ByVal hMenu As
Long, _
ByVal uPosition As Long, ByVal uFlags As Long)
Declare Function GetMenuItemCount Lib "user32" _
(ByVal hMenu As Long) As Integer			
		

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!

Join the Analytics Modernization Program

Remove banner from view

Modernize without compromising your valuable QlikView apps with the Analytics Modernization Program. Click here for more information or reach out: ampquestions@qlik.com