use SaveFileDialog in Class Library Proj w/o a Form - possible?

G

Guest

I want to create a class library project (dll) for use with a com app. The
idea is to use .Net objects in com. I also want to include a SaveFileDialog
in the class library. Is it possible to include a SaveFileDialog object in
my library project without having to include a form in the project? how to
do this?

Thanks,
Rich
 
P

Peter Duniho

I want to create a class library project (dll) for use with a com app.
The
idea is to use .Net objects in com. I also want to include a
SaveFileDialog
in the class library. Is it possible to include a SaveFileDialog object
in
my library project without having to include a form in the project? how
to
do this?

Why do you want to include a SaveFileDialog object in your project? Why
not just instantiate it as needed?

For what it's worth, I use the SaveFileDialog in many of my projects, and
I have not once actually included it as a component for any form. I
always just instantiate one as needed. There are a number of these sorts
of classes that _can_ be dragged and dropped into your form so that you
have easy access to an instance of one, but where doing so isn't actually
necessary.

If you still feel you need an instance to be predefined in your project,
perhaps you can be more specific as to why you want to do that.
Otherwise, I recommend you simply create a new instance as needed.

Pete
 
Z

zacks

I want to create a class library project (dll) for use with a com app. The
idea is to use .Net objects in com. I also want to include a SaveFileDialog
in the class library. Is it possible to include a SaveFileDialog object in
my library project without having to include a form in the project? how to
do this?

Thanks,
Rich

You'll need to add a reference to System.Windows.Forms to the DLL
project.
 
G

Guest

Thank you all for your replies.

Using System.Windows.Forms

that is what I was looking for. Now I instantiate it just as needed.
Thanks all.

One more question: I am using this dll with MS Access to read data from Sql
Server and write it to a text file using sqlDataAdapter, StreamWriter.
Anyway, I am deploying the Access app from a console application that starts
up the Access app with the Process object. I have been deploying the Access
app via this console app successfully since "Click Once" became available.
Now I have to deploy and register this custom dll for com on each workstation
that uses the Access app. I have copied the compiled dll and tlb to the
console app for output. I also added a .bat for registering this dll. But
the dll is not registering correctly on the destination workstation, and
everytime I deploy this app a copy of the dll, tlb and .bat files are also
copied. So the destination workstation ends up with several copies of the
same dll files.

What is the correct way to deploy this dll and register it on the
destination workstation(s) (in test environment right now). Do I need to
deploy the dll separately?

Thanks,
Rich
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top