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 3637238
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T01:08:00+00:00 2026-05-19T01:08:00+00:00

I’ve a windows forms desktop application which keeps contact details. The application stores contacts

  • 0

I’ve a windows forms desktop application which keeps contact details. The application stores contacts data as below when closing the application,

private void MyForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            try
            {
                Properties.Settings.Default.ApplicationData = mydata;
                Properties.Settings.Default.Save();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

When application starts it load data as below,

      try
      {     
         this.mydata = (DataHandeler) Properties.Settings.Default.ApplicationData;

}
        catch (NullReferenceException)
        {
            mydata = new DataHandeler();
        }
        catch (Exception e)
        {
            MessageBox.Show(e.Message);
            mydata = new DataHandeler();
        }

SettingsSerializeAs has been added into Settings.Designer.cs as below,

[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.SettingsSerializeAs( System.Configuration.SettingsSerializeAs.Binary)]

public object ApplicationData {
    get {
        return ((object)(this["ApplicationData"]));
    }
    set {
        this["ApplicationData"] = value;
    }

But application cannot recover already stored data after each time I close and re-open the application. Nullreferenceexception is thrown when application trying to load data. How can I recover the data?

  • 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. Editorial Team
    Editorial Team
    2026-05-19T01:08:00+00:00Added an answer on May 19, 2026 at 1:08 am

    Is there an exception being thrown when the settings are saved or loaded?

    Are the settings actually being saved to the file?
    On Windows Vista or 7, there should be a user.config file in a directory named something like:

    C:\Users\{user_name}\AppData\Roaming\Microsoft\{project_or_assembly_name}\{version_number}\user.config

    Is your DataHandeler class serializable?

    This MSDN thread might also help.

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

Sidebar

Related Questions

I have a Windows.Forms based .NET desktop application that stores privileged information in a
I also have a desktop application written in Windows Forms that is a middling
I have developed a small desktop application in c#(using windows forms). For this project
I have a windows form which I am using as a desktop application. Now
Case : I'm creating a desktop application with VB.NET (Windows Forms), and using SQL
Case : I'm creating an application (desktop application) with VB.NET (actually windows form), and
I'm trying to build my own custom control for a windows forms application in
Possible Duplicate: Open a URL from Windows Forms Hello! I have a C# desktop
My Windows Forms application starts another one; the latter is meant to remain hidden,
I have a desktop application that on first execution prompts for the connection details

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.