T
Terry
I have a windows form application for which I have built a number of custom
user controls. Thinking that it would be a good idea to keep them in a
seperate project (maybe not such a good idea) that is what I did.
I have decided to make some of the behaviors of some of the user controls
subject to "user settings". So, I added some settings to the user control
library and set about trying to manipulte those settings from the .exe that
references the dll.
Hmmmmm...
Of course I could add a class with properties to 'wrap' all the settings and
expose them, but that seemed like a waste. Thought that there must be a
better (easier) way to do this.
I tried to add a class and a readonly property to the control library
project to return the My.Settings like this...
Public Class UserSettings
Public Shared ReadOnly Property Settings() As My.MySettings
....
but get an error saying I can't expose the type 'My.MySettings" outside the
project ...
....since the MySettings Class is declared as Friend.
So, one way to get around the problem is to go into the Settings.Designer.vb
and change it to Public.
I wonder if that is such a good idea?
I also discovered that if I used the concept of friend assembly and declared
the .exe to be a friend assembly, then I could get at the entire My namespace
of the dll.
Is this a better idea?
Now while on the subject of friend assemblies...
I had put all these custom controls in a different project just because it
seemed cleaner. I can't forsee using them in any other project and thought
that maybe I could hide them from the outside world by once again declaring
the .exe as a friend assembly and changing the scope of each control to
Friend. The only problem is, is that they then disapear out of the toolbox!
So, at design time, you can't create any more or them.
Ok, so I changed them back to Public and changed the constructors to Friend,
and the designer started complaining and giving me error messages.
So, I guess I have to either live with customers being able to get at my
custom control library or I have to move them back into the original .exe
project.
Any other ideas?
user controls. Thinking that it would be a good idea to keep them in a
seperate project (maybe not such a good idea) that is what I did.
I have decided to make some of the behaviors of some of the user controls
subject to "user settings". So, I added some settings to the user control
library and set about trying to manipulte those settings from the .exe that
references the dll.
Hmmmmm...
Of course I could add a class with properties to 'wrap' all the settings and
expose them, but that seemed like a waste. Thought that there must be a
better (easier) way to do this.
I tried to add a class and a readonly property to the control library
project to return the My.Settings like this...
Public Class UserSettings
Public Shared ReadOnly Property Settings() As My.MySettings
....
but get an error saying I can't expose the type 'My.MySettings" outside the
project ...
....since the MySettings Class is declared as Friend.
So, one way to get around the problem is to go into the Settings.Designer.vb
and change it to Public.
I wonder if that is such a good idea?
I also discovered that if I used the concept of friend assembly and declared
the .exe to be a friend assembly, then I could get at the entire My namespace
of the dll.
Is this a better idea?
Now while on the subject of friend assemblies...
I had put all these custom controls in a different project just because it
seemed cleaner. I can't forsee using them in any other project and thought
that maybe I could hide them from the outside world by once again declaring
the .exe as a friend assembly and changing the scope of each control to
Friend. The only problem is, is that they then disapear out of the toolbox!
So, at design time, you can't create any more or them.
Ok, so I changed them back to Public and changed the constructors to Friend,
and the designer started complaining and giving me error messages.
So, I guess I have to either live with customers being able to get at my
custom control library or I have to move them back into the original .exe
project.
Any other ideas?