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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T06:02:47+00:00 2026-05-16T06:02:47+00:00

I built a program, and i press a button, the program crashes. Here is

  • 0

I built a program, and i press a button, the program crashes.
Here is the button’s code:

            _alRecord.WriteXml(@".\alRecord.xml", XmlWriteMode.WriteSchema);

Debuging returned StackoverFlow(location is marked in a comment), Here is the whole code:

        private string alFile = @".\alRecord.xml";

    public DataTable alRecord;
    public DataTable _alRecord
    {
        get
        { //location of stackoverflow
            if (_alRecord == null)
            {
                alRecord = new DataTable();
                if (File.Exists(alFile))
                { _alRecord.ReadXml(alFile); }
                else
                { InitDataTable2(_alRecord); }
            }
            return _alRecord;
        }
    }

    private void InitDataTable2(DataTable table)
    {
        table.TableName = "AlTable";
        table.Columns.Add("ID", typeof(int));
        table.Columns.Add("sun", typeof(bool));
        table.Columns.Add("mon", typeof(bool));
        table.Columns.Add("tue", typeof(bool));
        table.Columns.Add("wed", typeof(bool));
        table.Columns.Add("thu", typeof(bool));
        table.Columns.Add("fri", typeof(bool));
        table.Columns.Add("sat", typeof(bool));
        table.Columns.Add("doors", typeof(string));
        table.Columns.Add("from1", typeof(DateTime));
        table.Columns.Add("to1", typeof(DateTime));
        table.Columns.Add("from2", typeof(DateTime));
        table.Columns.Add("to1", typeof(DateTime));
        for (int i = 0; i < 99; i++)
        {
            var row = alRecord.NewRow();
            row["ID"] = i;
            row["sun"] = false;
            row["mon"] = false;
            row["tue"] = false;
            row["wed"] = false;
            row["thu"] = false;
            row["fri"] = false;
            row["sat"] = false;
            row["doors"] = "";
            row["from1"] = "00:01";
            row["to1"] = "23:59";
            row["from2"] = "00:01";
            row["to2"] = "23:59";
            alRecord.Rows.Add(row);
        }
    }
    private void alSave_Click(object sender, EventArgs e)
    {
        _alRecord.WriteXml(@".\alRecord.xml", XmlWriteMode.WriteSchema);
    }
  • 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-16T06:02:48+00:00Added an answer on May 16, 2026 at 6:02 am

    You are calling your property from inside the getter of your property:

    public DataTable _alRecord
    {
        get
        {
            if (_alRecord == null) // <= whoops
    

    That causes an infinite recursion – calling the getter of the property to see if it returns null calls the getter of the property to see if it returns null calls the getter of the property…

    @Dave makes a good point in the comments – in c# it is common to use a naming convention that your property is CasedLikeThis and the backing field (the field where the property actually stores its value is _namedLikeThis. It makes it easier to distinguish – you always know the _ means backing field, and vice versa.

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

Sidebar

Ask A Question

Stats

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

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

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

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

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You only want to return true after all the checks,… May 16, 2026 at 6:44 pm
  • Editorial Team
    Editorial Team added an answer Every constructor of a subclass must invoke a constructor of… May 16, 2026 at 6:44 pm
  • Editorial Team
    Editorial Team added an answer After taking a look at the built-in Mail application I… May 16, 2026 at 6:44 pm

Trending Tags

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

Top Members

Related Questions

UPDATE: I've build a WPF app with no code behind, just put in a
I am looking for a means to kill a Windows exe program that, when
I have a problem and that is my SplashScreen I have. It is built
I have an, at least to me, strange case here: I have a relatively
I have built a console application that works okay when it references a .exe
I have built the Boost library from these instructions: http://stackoverflow.com/questions/3529163/install-boost-library-in-visual-c-2008 Directory of the unzipped
I'm building a program in WPF which must feature multi-language support, with the ability
I've built ACE.dll and ACE.lib of the ACE library. But when I link it
I've built and installed my service from vs2010 onto a 64bit machine. My problem
I've built my application in Netbeans 6.8. The application contains various references to third

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.