G
Guest
Hello,
I created a basic class library (dll, tlb) in VB2005 for com use in MS
Access. I added a form to the class library because eventually, I want to
use a SaveDialog control with this dll. I compiled the class to be com
visible and register for com (in the compile tab). The build went
successfully, and I can invoke the class from an MS Access code module. Upon
invoking the dll, you can see the dll form for a split second, then it goes
to the background, although the form's icon is in the windows status bar (or
whatever it's called - the thing with all the open app icons). So I can
bring the form to the front by clicking its icon. Eventually, the dll is
going to copy data from Access to Excel using ADO.net. How can I implement
the SaveDialog control/class in my dll? Here is the code for the test dll
which works - except that the form goes to the background:
------------------------------------------------------------------------------------
Imports System.Runtime.InteropServices
<Guid("A87CC055-687F-4116-AC3A-71D3B2447A09"), _
InterfaceType(ComInterfaceType.InterfaceIsIDispatch)> _
Public Interface _IHelloWorld
<DispId(1)> Sub HelloWorld(ByVal s1 As String)
<DispId(2)> Sub Openfrm(ByVal s1 As String)
End Interface
<Guid("E96A973D-A533-4BC0-B57A-6C52409F6BBE"), _
ClassInterface(ClassInterfaceType.None), _
ProgId("testDLL.clsTestDLL")> _
Public Class clsTestDLL Implements _IHelloWorld
Public Sub HelloWorld(ByVal s1 As String) Implements _IHelloWorld.HelloWorld
MsgBox("Hello, World from my test! -- " & s1)
End Sub
Public Sub Openfrm(ByVal s1 As String) Implements _IHelloWorld.Openfrm
Dim frm As New Form1
frm.Text = s1
frm.Show()
frm.BringToFront()
End Sub
End Class
----------------------------------------------------------------------------
and here is my code for the GUID generator for the Interface. I invoke the
new GUID string from a regular app with a straight forward button on a form
Dim guidString As String = String.Format("Guid(""{0}"")",
Guid.NewGuid().ToString().ToUpper())
'-- Copy string GUID to clipboard
Clipboard.SetText(guidString)
Is there a way I could invoke the SaveDialog control/class in my dll without
using a form?
Thanks,
Rich
I created a basic class library (dll, tlb) in VB2005 for com use in MS
Access. I added a form to the class library because eventually, I want to
use a SaveDialog control with this dll. I compiled the class to be com
visible and register for com (in the compile tab). The build went
successfully, and I can invoke the class from an MS Access code module. Upon
invoking the dll, you can see the dll form for a split second, then it goes
to the background, although the form's icon is in the windows status bar (or
whatever it's called - the thing with all the open app icons). So I can
bring the form to the front by clicking its icon. Eventually, the dll is
going to copy data from Access to Excel using ADO.net. How can I implement
the SaveDialog control/class in my dll? Here is the code for the test dll
which works - except that the form goes to the background:
------------------------------------------------------------------------------------
Imports System.Runtime.InteropServices
<Guid("A87CC055-687F-4116-AC3A-71D3B2447A09"), _
InterfaceType(ComInterfaceType.InterfaceIsIDispatch)> _
Public Interface _IHelloWorld
<DispId(1)> Sub HelloWorld(ByVal s1 As String)
<DispId(2)> Sub Openfrm(ByVal s1 As String)
End Interface
<Guid("E96A973D-A533-4BC0-B57A-6C52409F6BBE"), _
ClassInterface(ClassInterfaceType.None), _
ProgId("testDLL.clsTestDLL")> _
Public Class clsTestDLL Implements _IHelloWorld
Public Sub HelloWorld(ByVal s1 As String) Implements _IHelloWorld.HelloWorld
MsgBox("Hello, World from my test! -- " & s1)
End Sub
Public Sub Openfrm(ByVal s1 As String) Implements _IHelloWorld.Openfrm
Dim frm As New Form1
frm.Text = s1
frm.Show()
frm.BringToFront()
End Sub
End Class
----------------------------------------------------------------------------
and here is my code for the GUID generator for the Interface. I invoke the
new GUID string from a regular app with a straight forward button on a form
Dim guidString As String = String.Format("Guid(""{0}"")",
Guid.NewGuid().ToString().ToUpper())
'-- Copy string GUID to clipboard
Clipboard.SetText(guidString)
Is there a way I could invoke the SaveDialog control/class in my dll without
using a form?
Thanks,
Rich