473,405 Members | 2,334 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

how to add SaveDialog to my custom VB class Lib (dll) for com use?

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.InterfaceIsIDispatc h)_
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

Jul 9 '07 #1
1 1722
Well, I went ahead and added a SaveFileDialog to the form and was able to
invoke it from Access, and it actually worked fine. For SaveDialog stayed in
from because I opened it ShowDialog, and I don't show the Form - just the
SaveFileDialog.

If frm.SaveDlg1.ShowDialog = Windows.Forms.DialogResult.OK Then
s1 = frm.SaveDlg1.FileName
MsgBox(s1)
End If

I am sort of happy now because I can move on with the project, but I am sure
there is a way to use a SaveFileDialog class without the overhead of a form.
Would this be more efficient if I used the SaveFileDialog without the form,
or is it better to keep it simple by using the SaveFileDialog with the form?

"Rich" wrote:
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.InterfaceIsIDispatc h)_
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
Jul 9 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Angela | last post by:
I wrote a class that I intended to be a custom action. I added the DLL for the class to the setup project using the CustomActions editor. When I run the installer it completely ignores the custom...
3
by: Paul Phillips | last post by:
Here is what I am trying to do. I have an application that is written in VB 6 and in this application it is accessing a custom dll file that was created using Microsoft Fortran Professional 4.0....
1
by: Caronte | last post by:
Hi all, I have a problem using Custom control class inside a DLL Extension. My Custom control use Class property to specify the register class name for the control. Both Dialog Class and...
2
by: Technical Support | last post by:
Good afternoon, I created a custom control, compiled it into a DLL, and added it to the BIN directory. I placed an instance of the control in a webForm and am trying to programatically change its...
7
by: Adam | last post by:
Im trying to add an httphandler for all *.sgf file extensions. I have developed the handler, 1. installed it into the gac 2. added it to the machine.config: <httpHandlers> <add verb="*"...
3
by: Wayne | last post by:
1. I have created my own class that inherits the textbox (called it CyanFocusTextBox). I put in some code and some new properties. All this works. I build the dll that contains this class...
12
by: Noel | last post by:
Hello, I'm currently developing a web service that retrieves data from an employee table. I would like to send and retrieve a custom employee class to/from the webservice. I have currently coded...
0
swatmajor1
by: swatmajor1 | last post by:
Hi There In my attemps to make my own media player, I have learnt many things. But one thing still eludes me, the use of VB2005 SaveDialog. I can get it working, the file extension list and such,...
5
by: Alias | last post by:
Hi - I'm trying to implement a custom RoleProvider based on the SqlRoleProvider. I keep receiving a an error that it can't load type 'MyRoleTest.MyRoleProvider' when trying to load my...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.