473,732 Members | 2,207 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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("A87CC0 55-687F-4116-AC3A-71D3B2447A09"), _
InterfaceType(C omInterfaceType .InterfaceIsIDi spatch)_
Public Interface _IHelloWorld
<DispId(1)Sub HelloWorld(ByVa l s1 As String)
<DispId(2)Sub Openfrm(ByVal s1 As String)
End Interface

<Guid("E96A97 3D-A533-4BC0-B57A-6C52409F6BBE"), _
ClassInterface( ClassInterfaceT ype.None), _
ProgId("testDLL .clsTestDLL")_
Public Class clsTestDLL Implements _IHelloWorld

Public Sub HelloWorld(ByVa l s1 As String) Implements _IHelloWorld.He lloWorld
MsgBox("Hello, World from my test! -- " & s1)
End Sub

Public Sub Openfrm(ByVal s1 As String) Implements _IHelloWorld.Op enfrm
Dim frm As New Form1
frm.Text = s1
frm.Show()
frm.BringToFron t()
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().ToUp per())

'-- Copy string GUID to clipboard
Clipboard.SetTe xt(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 1734
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.Sh owDialog = Windows.Forms.D ialogResult.OK Then
s1 = frm.SaveDlg1.Fi leName
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("A87CC0 55-687F-4116-AC3A-71D3B2447A09"), _
InterfaceType(C omInterfaceType .InterfaceIsIDi spatch)_
Public Interface _IHelloWorld
<DispId(1)Sub HelloWorld(ByVa l s1 As String)
<DispId(2)Sub Openfrm(ByVal s1 As String)
End Interface

<Guid("E96A97 3D-A533-4BC0-B57A-6C52409F6BBE"), _
ClassInterface( ClassInterfaceT ype.None), _
ProgId("testDLL .clsTestDLL")_
Public Class clsTestDLL Implements _IHelloWorld

Public Sub HelloWorld(ByVa l s1 As String) Implements _IHelloWorld.He lloWorld
MsgBox("Hello, World from my test! -- " & s1)
End Sub

Public Sub Openfrm(ByVal s1 As String) Implements _IHelloWorld.Op enfrm
Dim frm As New Form1
frm.Text = s1
frm.Show()
frm.BringToFron t()
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().ToUp per())

'-- Copy string GUID to clipboard
Clipboard.SetTe xt(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
1625
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 action I set up. First I put everything in the class constructor in the order I wanted it performed, I thought maybe the constructor would be called by the installer. Well, that didn't work so I created a Main method just to see if that
3
2180
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. Now I have created the same application as far as user interface in a ASP.Net web application but I am having trouble accessing the Fortran dll file. I am doing the DLLImport statement in a class by itself. I make an instance of this class...
1
4872
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 Custom control class are inside the dll. When i run the application i can't view the dialog and Vc++ display an error on ShowWindow procedure.
2
1688
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 properties via the Page_Load subroutine in a code-behind file. Can someone please tell me the proper procedure for declaring the new custom control in the code-behind file? I have supplied all of the code associated with this very basic example...
7
2917
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="*" path="*.sgf" type="CustomExtensionHandler, Extenders.CustomExtensionHandler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d831d925597c1031" validate="True"/> </httpHandlers>
3
1275
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 successfully. 2. I add it to the user controls section of toolbox and it appears. 3. I add the new CyanFocusTextBoxes to the form and it all works. 4. The problem comes when I update the class CyanFocusTextBox in the dll and rebuild it. ...
12
5340
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 the custom employee class and have built it as a separate library (employee.dll). This employee.dll is being referenced by both the web service and the windows application. I face the following problem when I send this class to the webservice.
0
1024
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, but when I go to save, the box just closes without saving the media file. If anyone has any experience with this please help. The source can be found at my website, www.swatmajor1.co.nr As always, any help is greatly appriciated Signing off, ...
5
8287
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 RoleProvider. However this only occurs after deployment. On my local machine it works fine. So I created the most basic role provider project I could think of. It is below: Imports System.Web.Security
0
8774
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9447
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9235
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9181
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6735
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6031
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4550
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4809
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3261
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.