Using a form, from a dll, to maintain properties in My.Settings


I have a document (attached to this question) that outlines the code I am using, and that some how  I want to include in my other projects (as a dll).  The end result, is that I want allow my users to update their data source names in the programs they use (which is what the dll is intended to do).

This works great for the Data Source Names (dsn) that are included in the dll's project, but if I include this project (as a dll), it won't reference the values in the parent program's My.Settings list.  It is still looking for a list of My.Settings for the local project (dll).

By this, I mean that I run a program (ex. Project 1) that uses the DSNMaintenance dll.  I want the DSNMaintenance.dll to look at Project 1's My.Setting list, and not it's own.  

Now, I could just include the form from the project, and it works great, but, if I wanted to make a change to that form, I'd have to update it in every project I use.

What do I need to change in my DSNMaintenance project to expose the My.Settings list of the parent project that references the dll?

Looking for syntax help, please!

Thanks in advance!
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

indy500fanAuthor Commented:

In a nutshell, is this saying that I need to build my list of settings in my main project, and then pass that to my dll?

If so, can you help me with the building of the list to pass?
I think you can define a property in the DLL which you form can access so you set it equal to my.settings at runtime before showing the form.
Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

indy500fanAuthor Commented:
Code Cruizer,

Can you help me with that syntax help, please?

Public class ...

Public Property AppSettings As Object

Then in form

Dim set as New classname
set.AppSettings = My.Settings
indy500fanAuthor Commented:
Uh...sorry...a little more help, please?

You have to remember, I wasn't that great a developer before, and it's been two years since I've done this.  

What goes where?  My form is in my DLL, so I'm not sure which you are referring to.
indy500fanAuthor Commented:
Code Cruizer...

Is it possible that you haven't looked at my specific example?  I appreciate that you help a lot of people, but I said from the beginning that I was looking for syntax help, and I would appreciate help for my specific example.

I am looking up all the Settings, that contain the string dsn, and then putting them into a list, not just a single know property as it seems in the link you gave me.

Does that help you to understand where I am coming from?

Best Regards,
indy500fanAuthor Commented:
Code Cruizer,

You there?
Yes. The code I wrote was mainly suedo code to give you an idea.

The main idea is that you need to pass the reference of your My.Settings class into the DLL somehow. So if you have a form in DLL, you need to define a public property on that form and then set this property to My.Settings at runtime before you show the form so that form is able access the settings indirectly.
indy500fanAuthor Commented:
Can you create the code for the Property?  I'm not sure how to implement a property for the My.Settings as you describe.  I think I might be able to figure out the rest after that.
I already did

Public Property AppSettings As Object

Its object because My.Settings is dynamic. You can still use the

AppSettings.MySetting = value

as you as you are sure that settings exists.
indy500fanAuthor Commented:

Okay, let me be VERY specific...Can you write the rest of the Property code.

including the Get and Set, please.

There is no need for that with the auto implemented properties. If you want to go that route then

private _AppSettings As Object
Public Property AppSettings As Object
   Return _AppSettings
End Get
Set(Value As Object)
   _AppSettings = Value
End Set
End Property

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
indy500fanAuthor Commented:
I will try this tonight or tomorrow.  Thanks!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.