Re: My.Settings Questions



Yes, I finally figured it out after playing with ConfigurationManager and RoamingUserANdLocal stuff to get the application user.config. I ended up not needed it but it lead me to what you are saying.

The user.config will contain a userSettings for the EXE and DLL. Duplicated it but the ended just the one in the DLL since it is self contained and used properties to all the EXE to setup if it needs too.

thanks for your input

--


Michel Posseth [MCP] wrote:
Hello Mike

You do not need to pass a my.settings instance to the constructor
you can just use the common my.settings fields inside your class
as the settings are used from the calling assembly

So you define the same properties in both projects but during runtime the farmework automaticly uses the properties from the calling assembly ( the exe ) in fact you need to perfom some extra coding if you want to use the setting stored in the config from the called assembly ( the dll )

HTH

Michel Posseth



"Mike" <unknown@xxxxxxxxxx> schreef in bericht news:es4TJeb5JHA.3860@xxxxxxxxxxxxxxxxxxxxxxx
I never really used VB6 at this level.

Overall, I have

Project.EXE
ControlLibrary.DLL

There is a FORM in the library. I need to make the DLL use the Application My.Settings.

--


Cor Ligthert[MVP] wrote:
Mike,

The my.Settings is build to make a bridge between VB6 users and Net

It works like VB6

Cor


"Mike" <unknown@xxxxxxxxxx> wrote in message news:OPoC8Ea5JHA.6136@xxxxxxxxxxxxxxxxxxxxxxx
I just started using My.Settings in my VB.NET project. I think its really cool the way the IDE allows you create it, etc.

I have an implementation question:

I haved this:

- general LoginForm in a class library (DLL)

- A multi-user application (EXE)

Application is run from a share drive, each user
has its own credentials he can save on his PC.

Overall, what is recommended approach use MySettings here from the standpoint of passing and/or where the form will initialize its fields?

The form has:

UserName:
Password:

[_] Remember Credentials
[_] Auto Login

(_) Use Local Server
(_) Pick Server
(_) Use this server ________________

The question is this:

Should the EXE has the My.Settings and prepare the login form before doing a ShowDialog or can I do this in the Loginform class Load event by passing My.Settings to the constructor?

For example:

Public Class LoginForm

Public UserSettings As My.Settings

Private Sub LoginForm_Load( _
ByVal sender As Object, _
ByVal e As System.EventArgs) Handles Me.Load

chkRemember.Checked = UserSettings.UseRemember <-- invalid
chkAutoLogin.Checked = UserSettings.UseAutoLogin <-- invalid
etc
...
End Sub
End Class

The problem is that compiler issues the error:

error BC30909: 'UserSettings' cannot expose type 'My.MySettings' outside the project through class 'LoginForm'.

Of course, I can do this outside the form or maybe use properties from outside the form.

Is that the way or is there another method?

Thanks

--



.



Relevant Pages

  • Re: Editors
    ... some strip them on exe files by default. ... "preferred base address" and, yup, relocations are completely ... DLL files, though, aren't loaded into their own address space but are ... EXE's "entry-point", though, is not "special" in that it's just an ...
    (alt.lang.asm)
  • Re: DLL pass vector by value crash
    ... The prototype for testfunc is a by-value copy, so it has to make a copy of the value. ... Are you using static linking for either the .exe (if so, it probably won't work correctly, ... clearly using the shared CRT DLL for the DLL you are constructing. ... no crash occurs in either config. ...
    (microsoft.public.vc.mfc)
  • Re: DLL pass vector by value crash
    ... stack of the exe and may allocate default member element on the exe heap. ... If this is a dangerous situation, the simple app I set up calling testFunc() ... in a dll did not crash. ... msvcr90.dll!free and access the source code of free.c. ...
    (microsoft.public.vc.mfc)
  • Re: Releasing my VB.NET app over the intranet
    ... of the primary EXE and when compiled I am copying the contents ... the directory and open a browser on the web server and type ... > another dll, we need to put the dll in the same directory, so that the clr ... > The executable will be downloaded to the assembly download cache on the ...
    (microsoft.public.dotnet.framework)
  • Premature .dll loading caused by "Project Dependencies" options
    ... The client .exe is a simple MFC query tool. ... But when I debug the .exe, I see that the ODBC driver .dll is being loaded ...
    (microsoft.public.dotnet.languages.vc)