FAQ (exnethost)
Exontrol.COM Software - Frequently Asked Questions - ExNETHost Component
1:
The control's release notes can be found on our web site, looking for the Release Notes column in the control's main page. Click here for direct link.
2:
In MS Access, you need to use the MoveWindow API function to resize the NETHost control into a MS Access Form like in the following sample:
Private Declare Function apiMoveWindow Lib "User32" Alias "MoveWindow" _
         (ByVal hWnd As Long, ByVal X As Long, ByVal Y As Long, ByVal _
         nWidth As Long, ByVal nHeight As Long, ByVal bRepaint As Long) _
         As Long
         
Private Sub Command1_Click()
    With NETHost1
        .Visible = False
        apiMoveWindow .hWnd, .Top / 15, .Left / 15, 512, 512, -1
        .Visible = True
    End With
End Sub
3:
4:

The control fires the HostEvent(Ev) event as soon as the inner control fires an event. The Ev parameter of the HostEvent event holds all information about the event such as name, identifier and all its arguments. The AsString property of the Ev object (NETHostEvent type) gives a brief description of the event including its arguments such as "MouseMove[72] {Button = Left, Clicks = 0, X = 69, Y = 53, Delta = 0, Location = {X=69,Y=53}}", where MouseMove is the name of the event (Name property), 72 is the event's identifier (ID property), and arguments separated by comma between {} characters as follow: Button argument with the value "Left", Clicks argument with the value of 0, X argument with the value 69, Y parameter with the value of 53, Delta argument with the value of 0 and Location parameter as an object/structure with two fields X and Y.

The following sample displays brief information about firing events:

Private Sub NETHost1_HostEvent(ByVal Ev As exontrol_NETHostCtl.INETHostEvent)
	With NETHost1
			Debug.Print Ev.AsString()
	End With
End Sub

and the output may look as follows:

MouseMove[72] {Button = Left, Clicks = 0, X = 69, Y = 53, Delta = 0, Location = {X=69,Y=53}}
NodeMouseHover[15] {Node = TreeNode: Sub-Child 2.1}
Click[42] {Button = Left, Clicks = 1, X = 69, Y = 53, Delta = 0, Location = {X=69,Y=53}}

For instance, let's say we need to handle the MouseMove event of the System.Windows.Forms.TreeView inner control, so we need a handler as follows:

Private Sub NETHost1_HostEvent(ByVal Ev As exontrol_NETHostCtl.INETHostEvent)
	With Ev
			If (.Name = "MouseMove") Then
					With .Arguments
							Debug.Print "Button", .Item("Button").AsInt
							Debug.Print "Clicks", .Item("Clicks").AsInt
							Debug.Print "X", .Item("X").AsInt
							Debug.Print "Y", .Item("Y").AsInt
							Debug.Print "Delta", .Item("Delta").AsInt
							Debug.Print "Location.X", .Item("Location.X").AsInt
							Debug.Print "Location.Y", .Item("Location.Y").AsInt
					End With
			End If
	End With
End Sub
5:
You can create your own custom .NET library and use it through the control, allowing you to interact with the inner control almost as if it were a native COM control. The following example explains how to do this using the exg2antt/net assembly in the VB6 IDE, but the same approach applies to any .NET assembly.

Do the following steps:

  1. download and install the exg2antt/net control from its main page. If ExNETHost is going to be used in a 32-bit application, then install the 32-bit version of exg2antt/net, and if ExNETHost is going to be used in a 64-bit application, then install the 64-bit version of exg2antt/net. By default, the 32-bit version of exg2antt/net is installed in the C:\Program Files (x86)\Exontrol\ExG2antt.NET folder, and the 64-bit version of exg2antt/net is installed in the C:\Program Files\Exontrol\ExG2antt.NET folder.
  2. Open VB6 IDE, create a new project, then add the ExNETHost control to the project by right-clicking on the toolbox, and choosing Components, then looking for the Exontrol's NETHost Control in the list, and checking it, then clicking OK. After that, you can drag and drop the control from the toolbox to your form.
  3. Open the form's Load event, and add the following code to it:
    Private Sub Form_Load()
        With NETHost1
            .AssemblyLocation = "C:\Program Files (x86)\Exontrol\ExG2antt.NET\Sample\exontrol.exg2antt.dll"
        End With
    End Sub

    The sample exg2antt/net assembly is located in the Sample folder of the exg2antt/net installation folder, and its name is exontrol.exg2antt.dll. The AssemblyLocation property of the control takes the path of the assembly we want to use, so we set it to the path of the sample exg2antt/net assembly.

  4. Save the project, and run it. You will see the sample exg2antt/net control loaded in your form, and you can use it as if it is a native COM control. For instance, you can set some of its properties as follows:
    Private Sub Form_Load()
        With NETHost1
            .AssemblyLocation = "C:\Program Files (x86)\Exontrol\ExG2antt.NET\Sample\exontrol.exg2antt.dll"
            Debug.Print .AssemblyQualifiedName
            With .Host
                .Template = "ColumnAutoResize = True;HeaderAppearance = 1;HeaderVisible = 1"
                .Template = "Chart{LevelCount = 2;PaneWidth(False) = 128;FirstVisibleDate = #1/1/2026#;}"
                .Item("Columns.Add(`Name`)").Template = "DisplayFilterButton = True"
                With .Item("Items")
                    .Template = "AddBar(AddItem(`Task A`),`Task`,#1/2/2026#,#1/8/2026#)"
                    .Template = "AddBar(AddItem(`Task B`),`Task`,#1/4/2026#,#1/10/2026#)"
                End With
            End With
        End With
    End Sub
    

    The AssemblyQualifiedName property of the control gives the assembly/qualified name of the type that is loaded in the control, and the Host property gives access to the inner control, so you can set any property of the inner control using the Host property as if you are using a native COM control. Any inner control's method or property should be called using the Template property of the Host object.

    For instance, the following lines of code:
    • .Template = "ColumnAutoResize = True;HeaderAppearance = 1;HeaderVisible = 1" sets three properties of the inner control which are ColumnAutoResize, HeaderAppearance and HeaderVisible.
    • .Item("Columns.Add(`Name`)").Template = "DisplayFilterButton = True" calls the Add method of the Columns property of the inner control with one argument which is `Name`, then sets the DisplayFilterButton property of the added column to True.
    • With .Item("Items") block gives access to the Items property of the inner control, so any method or property that belongs to the Items property should be called using the Template property of the Item("Items") object, as follows:
      • .Template = "AddBar(AddItem(`Task A`),`Task`,#1/2/2026#,#1/8/2026#)" calls the AddBar method of the Items property of the inner control with three arguments which are AddItem(`Task A`), `Task`, #1/2/2026# and #1/8/2026#.
      • .Template = "AddBar(AddItem(`Task B`),`Task`,#1/4/2026#,#1/10/2026#)" calls the AddBar method of the Items property of the inner control with three arguments which are AddItem(`Task B`), `Task`, #1/4/2026# and #1/10/2026#.
It is worth mentioning that the control supports loading .NET assemblies that are built using any .NET language such as C#, VB.NET, C++/CLI, etc... and it also supports loading .NET assemblies that are built using any .NET framework version that is supported by the control. The Template property of the Host object is very powerful, it allows you to call any method or set any property of the inner control, and it also allows you to call any method or set any property of any child object of the inner control, so you can use it to do almost anything with the inner control as if you are using a native COM control.
How-To Questions
General Questions