G
Guest
I am trying to create one DLL that I can use in vbscripting that has all of
the common codes and other additional input forms, controls, etc. I have
DIS.DLL, namespace is DLL, and so far have written four COM Classes (Project
| Add Item | Com Class) so it automatically generates the GUID's for each of
my classes. Sample code for one of my classes is below.
On my development machine I can create this object just fine and call the
properties using Set DataGridView = CreateObject("DIS.DataGridView") and is
working as expected.
On my integration machine I tried dropping the DLL in C:\DIS and:
1. Double clicking on it to register to regsvr32 but get the error that the
entry point cannot be found
2. Using a regasm.exe tool that I have read about for COM classes, but get
an error saying -Failed to load DIS.DLL because it is not a valid .NET
assembly
3. Tried using gacutil.exe but am getting an error saying -Failure adding
assembly to the cache: unknown error.
Furthermore when I try to create the object in vbscript it will say it
cannot create the activeX component.
Any suggestions on how I can get this DLL in a usable state on
non-development machines?
====================================================
Imports System.IO
Imports System.Windows.Forms
<ComClass(DataGridView.ClassId, DataGridView.InterfaceId,
DataGridView.EventsId)> _
Public Class DataGridView
#Region "COM GUIDs"
' These GUIDs provide the COM identity for this class
' and its COM interfaces. If you change them, existing
' clients will no longer be able to access the class.
Public Const ClassId As String = "33e160c9-03f9-4142-b7fc-226fe49e920a"
Public Const InterfaceId As String =
"9dd5b3d6-5be8-409e-8c79-bb0388c0ed98"
Public Const EventsId As String = "d168723a-78dc-4b3d-a84a-97a998d2ca09"
#End Region
' A creatable COM class must have a Public Sub New()
' with no parameters, otherwise, the class will not be
' registered in the COM registry and cannot be created
' via CreateObject.
Public Sub New()
MyBase.New()
End Sub
Dim strMyFormName As String = "Data Grid View"
Dim MyDataGridView As New frmDataGridView()
Dim intCountColumn As Integer = 0
Dim intCountRow As Integer = 0
Dim intColumnIndexToValidate As Integer = -1
Dim dataDataTable As New DataTable()
Dim strSortQuery As String = ""
Public Sub AddColumn(ByVal strColumnName As String, ByVal blnReadOnly As
Boolean)
Dim colColumn As New DataGridViewTextBoxColumn
dataDataTable.Columns.Add(strColumnName)
colColumn.DataPropertyName = strColumnName
colColumn.ReadOnly = blnReadOnly
colColumn.HeaderText = strColumnName
colColumn.SortMode = DataGridViewColumnSortMode.Programmatic
MyDataGridView.dgvMyDataGrid.Columns.Add(colColumn)
Me.intCountColumn = Me.intCountColumn + 1
End Sub
Public Function DisplayDataGridView() As Boolean
...
End Function
...
...
End Class
the common codes and other additional input forms, controls, etc. I have
DIS.DLL, namespace is DLL, and so far have written four COM Classes (Project
| Add Item | Com Class) so it automatically generates the GUID's for each of
my classes. Sample code for one of my classes is below.
On my development machine I can create this object just fine and call the
properties using Set DataGridView = CreateObject("DIS.DataGridView") and is
working as expected.
On my integration machine I tried dropping the DLL in C:\DIS and:
1. Double clicking on it to register to regsvr32 but get the error that the
entry point cannot be found
2. Using a regasm.exe tool that I have read about for COM classes, but get
an error saying -Failed to load DIS.DLL because it is not a valid .NET
assembly
3. Tried using gacutil.exe but am getting an error saying -Failure adding
assembly to the cache: unknown error.
Furthermore when I try to create the object in vbscript it will say it
cannot create the activeX component.
Any suggestions on how I can get this DLL in a usable state on
non-development machines?
====================================================
Imports System.IO
Imports System.Windows.Forms
<ComClass(DataGridView.ClassId, DataGridView.InterfaceId,
DataGridView.EventsId)> _
Public Class DataGridView
#Region "COM GUIDs"
' These GUIDs provide the COM identity for this class
' and its COM interfaces. If you change them, existing
' clients will no longer be able to access the class.
Public Const ClassId As String = "33e160c9-03f9-4142-b7fc-226fe49e920a"
Public Const InterfaceId As String =
"9dd5b3d6-5be8-409e-8c79-bb0388c0ed98"
Public Const EventsId As String = "d168723a-78dc-4b3d-a84a-97a998d2ca09"
#End Region
' A creatable COM class must have a Public Sub New()
' with no parameters, otherwise, the class will not be
' registered in the COM registry and cannot be created
' via CreateObject.
Public Sub New()
MyBase.New()
End Sub
Dim strMyFormName As String = "Data Grid View"
Dim MyDataGridView As New frmDataGridView()
Dim intCountColumn As Integer = 0
Dim intCountRow As Integer = 0
Dim intColumnIndexToValidate As Integer = -1
Dim dataDataTable As New DataTable()
Dim strSortQuery As String = ""
Public Sub AddColumn(ByVal strColumnName As String, ByVal blnReadOnly As
Boolean)
Dim colColumn As New DataGridViewTextBoxColumn
dataDataTable.Columns.Add(strColumnName)
colColumn.DataPropertyName = strColumnName
colColumn.ReadOnly = blnReadOnly
colColumn.HeaderText = strColumnName
colColumn.SortMode = DataGridViewColumnSortMode.Programmatic
MyDataGridView.dgvMyDataGrid.Columns.Add(colColumn)
Me.intCountColumn = Me.intCountColumn + 1
End Sub
Public Function DisplayDataGridView() As Boolean
...
End Function
...
...
End Class