RE: Problem Using VB.net Class Library DLL in VBScript
- From: Brian Kudera <BrianKudera@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Sat, 27 Oct 2007 15:45:00 -0700
I'm going to try to include more detail that I already tried from reading
other posts:
1. I have verified that the AssemblyInfo.vb file in my project has
<Assembly: ComVisible(True)> .
2. In my project compile properties, I do have checked the 'Register for COM
interop.
3. Per another tutorial that I tried to follow, to register a .NET COM
object in the GAC, it has to be signed, so I created a key on the signing
settings of my project without a password and without the 'Delay sign only'
option.
I read a post from 2005 that mentioned including register and unregister
functions in your classes- is this what I am missing?
"Brian Kudera" wrote:
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
- References:
- Problem Using VB.net Class Library DLL in VBScript
- From: Brian Kudera
- Problem Using VB.net Class Library DLL in VBScript
- Prev by Date: Problem Using VB.net Class Library DLL in VBScript
- Next by Date: CASE or IF statement in Datacolumn.Expression
- Previous by thread: Problem Using VB.net Class Library DLL in VBScript
- Next by thread: Re: Problem Using VB.net Class Library DLL in VBScript
- Index(es):
Relevant Pages
|
Loading