Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 180255
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T14:33:14+00:00 2026-05-11T14:33:14+00:00

I have a stand-alone WinForms application, let’s call it Program A. Program A let’s

  • 0

I have a stand-alone WinForms application, let’s call it ‘Program A.’ Program A let’s a user create a file and save some information to it. Program A also exposes some public classes.

Another stand-alone WinForms application (‘Program B’) references Program A, and uses some of its public classes.

However, some of Program A’s classes need to open the file the user created in order to retrieve data from it. In Program A, the location of the user’s file is saved in the ‘Settings’ (as user-scope settings of course) and are retrieved (this is a VB.NET app) via My.Settings.

This is all well and good until Program B runs – when it runs and uses the classes from Program A that need to read from Program A’s My.Settings, the settings are blank – it’s as if they were reset (as when you run Program A for the first time or under a new user account). Any application-scope settings are kept, but any user-scope settings are reset to their default values (whatever they were set to in the IDE when Program A was written).

Here is a pseudo-code example:

Program A:

Namespace ProgramA      Public Class Foo          Public Shared Function GetStuff() as Object             File = OpenFile(My.Settings.UserFileName)             Return File.ReadStuff()         End Function      End Class  End Namespace 

Program B:

TheStuffIWant = ProgramA.Foo.GetStuff() 

Assume that the user has already run Program A at least once and opened a file, so Program A’s My.Settings.UserFileName should be set.

When Program B calls Foo.GetStuff(), it doesn’t return anything because My.Settings.UserFileName doesn’t contain the user’s file name – more accurately, it contains whatever the ‘default’ value for that setting was (as set in the IDE when you set up the setting in the first place). But, if you turn around and launch Program A, it remembers the user’s setting for UserFileName.

So – the question is: When calling a function in a referenced assembly, why are the user’s settings not retained? Is there an explanation for the behavior I’m seeing, or am I missing something terribly obvious? Or perhaps I’m just going about this all wrong, and I shouldn’t have made any of the public classes in Program A rely on anything in My.Settings in the first place?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T14:33:15+00:00Added an answer on May 11, 2026 at 2:33 pm

    Your problem is that user-scoped settings are read by the executing application. Because you are referencing Program A from Program B rather than executing Program A, the classes in Program A are attempting to get settings that weren’t read by Program B.

    The point is that Program B has its own settings that are separate from Program A, and any class that’s being executed by Program B (regardless of where it’s defined) will use Program B’s settings.

    So with your setup the way it is, you’re out of luck.

    If you control both Program A and Program B, you can write a custom settings provider for both that would allow them to share common user-scope settings.

    The Application Settings Architecture article has a section on how to do this.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 119k
  • Answers 119k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Your requested Feature is currently not possible. I guess there… May 11, 2026 at 11:46 pm
  • Editorial Team
    Editorial Team added an answer What you want to make sure is that the query… May 11, 2026 at 11:46 pm
  • Editorial Team
    Editorial Team added an answer It's complicated. Start by reading my recent article on virtual… May 11, 2026 at 11:46 pm

Related Questions

I have a stand-alone WinForms application, let's call it Program A. Program A let's
Is it some sort of pre-built GUI scaffolding? Why would I Want it instead
I'm looking for a syntax-highlighting Textbox component, preferably free, with source, and capable of
I have a string representing a stand-alone (and valid XHTML 1.0 Strict) HTML document,
I have a problem that I feel is best implimented in a stand alone

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.