SaveFileDialog from DLL?

G

Guest

I'm writing a DLL code that has routines, one of which creates an Excel file
and saves it, if certain conditions are met. I want the main project in the
solution to call that routine in the DLL to create the file and I want the
user to specify the file name and location using the SaveFileDialog before
saving the file.

PS. In the DLL routine there are code lines that have to be executed before
and after calling the SaveFileDialog.

Is there a way to call the SaveFileDialog control from a dll ?
 
H

Herfried K. Wagner [MVP]

Amjad said:
In the DLL routine there are code lines that have to be executed before
and after calling the SaveFileDialog.

Is there a way to call the SaveFileDialog control from a dll ?

Add a reference to "System.Windows.Forms.dll" to the class library project,
then import the 'System.Windows.Forms' namespace and use the class:

\\\
Public Sub Foo()
...
Dim o As New SaveFileDialog()
If o.ShowDialog() = DialogResult.OK Then
...
End If
o.Dispose()
...
End Sub
///
 
G

Guest

Thank you Herfried. You answered my question.

I have a follow-up question though. Can I change/access any of the controls'
properties on the MainForm Project from my class library project (DLL)?

for example can I set the Enabled property of a TextBox to False from my DLL
program?
 

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