R
Rob
Is there a way to pass data between VBscript and a VB.net form ?
For example...,
Open a VB.net form , enter a value in a text box, then run a VBscript that
returns the value entered in the textbox via a VBScript message box.
I have seen some samples that are close to working... they return a value
that was hardcoded into the VB.net Class Library program.
By creating a Class library as follows... and Building the project....
Imports System.Runtime.InteropServices
<ComClass(ComClass1.ClassId, ComClass1.InterfaceId, ComClass1.EventsId)> _
Public Class ComClass1
#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 = "3c6c34ac-2447-4749-95c5-322afdc446fc"
Public Const InterfaceId As String =
"6cb9c355-2831-4ab2-9da1-625a445fa694"
Public Const EventsId As String = "99651d78-3838-4965-b2b8-e75099caa1cc"
#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
Public Function myFunction() As String
Return "Happy Day !"
End Function
End Class
THEN.... By running the following VBScript.... you get the desired result...
(at least part of the way)
Dim myObject
Set myObject = CreateObject("ClassLibrary1.COMClass1")
MsgBox myObject.myFunction
HOWEVER... Now I need to know how to make it work dynamically with a vb.net
form. I think I must create another project (somehow link to the class
library) and also change the ClassLibrary to return the value entered in the
vb.net form (as opposed to the hard-coded value).
Any thought on how to proceed from this point ?
For example...,
Open a VB.net form , enter a value in a text box, then run a VBscript that
returns the value entered in the textbox via a VBScript message box.
I have seen some samples that are close to working... they return a value
that was hardcoded into the VB.net Class Library program.
By creating a Class library as follows... and Building the project....
Imports System.Runtime.InteropServices
<ComClass(ComClass1.ClassId, ComClass1.InterfaceId, ComClass1.EventsId)> _
Public Class ComClass1
#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 = "3c6c34ac-2447-4749-95c5-322afdc446fc"
Public Const InterfaceId As String =
"6cb9c355-2831-4ab2-9da1-625a445fa694"
Public Const EventsId As String = "99651d78-3838-4965-b2b8-e75099caa1cc"
#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
Public Function myFunction() As String
Return "Happy Day !"
End Function
End Class
THEN.... By running the following VBScript.... you get the desired result...
(at least part of the way)
Dim myObject
Set myObject = CreateObject("ClassLibrary1.COMClass1")
MsgBox myObject.myFunction
HOWEVER... Now I need to know how to make it work dynamically with a vb.net
form. I think I must create another project (somehow link to the class
library) and also change the ClassLibrary to return the value entered in the
vb.net form (as opposed to the hard-coded value).
Any thought on how to proceed from this point ?