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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T15:25:56+00:00 2026-06-12T15:25:56+00:00

Im Having Problems Figuring Out Why I am Receiving an Object reference not set

  • 0

Im Having Problems Figuring Out Why I am Receiving an “Object reference not set to an instance of an object” Error in the Presentation Layer with this line:

TempAccountManager.Accounts.Add(tempAccount);

I Have Walked Through the Code With Visual Studios Debugger and the Account Gets Created. I Believe I Have an Issue With an Access Modifer, Not Sure.

Presentation Layer

using myBudget.BusinessObject;
using myBudget.BusinessLogic;

namespace myBudget
{
    public partial class NewBudgetWizard : Form
    {

        public int CurrentStep { get; set; }

        public Account TempAccount = new Account();
        public AccountManager TempAccountManager = new AccountManager();

        public NewBudgetWizard()
        {

        private void createAccountList(ListView lvAccounts)
        {

            foreach (ListViewItem lvi in lvAccounts.Items)
            {

                int tempAccNumber = Int32.Parse(lvi.SubItems[0].Text);
                string tempAccName = lvi.SubItems[1].Text;
                string tempAccType = lvi.SubItems[2].Text;
                decimal tempAccBalance = decimal.Parse(lvi.SubItems[3].Text, System.Globalization.NumberStyles.Currency);

                Account tempAccount = new Account(tempAccNumber, tempAccName, tempAccType, tempAccBalance, DateTime.Now);
                TempAccount = new Account(tempAccNumber, tempAccName, tempAccType, tempAccBalance, DateTime.Now);

                TempAccountManager.Accounts.Add(tempAccount);

            }

        }

    }
}

Business Logic Layer

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
using myBudget.BusinessObject;

namespace myBudget.BusinessLogic
{
    public class AccountManager : Account
    {

        public List<Account> Accounts { get; set; }

    }
}

Business Object

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace myBudget.BusinessObject
{
    public class Account
    {

        public int AccountID { get; set; }

        public int UserID { get; set; }

        public int Number { get; set; }

        public string Name { get; set; }

        public string Type { get; set; }

        public decimal Balance { get; set; }

        public DateTime ReconcileTimeStamp { get; set; }

        public Account()
        {

        }

        public Account(int number, string name, string type, decimal balance, DateTime reconcileTimeStamp)
        {
            Number = number;
            Name = name;
            Type = type;
            Balance = balance;
            ReconcileTimeStamp = reconcileTimeStamp;
        }

    }
}
  • 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-06-12T15:25:57+00:00Added an answer on June 12, 2026 at 3:25 pm

    The AccountManager Class Never Initializes The Accounts Property. Therefore TempAccountManager.Accounts Is Null.

    Adding A Constructor Like This Will Fix It.

    public class AccountManager : Account
    {
        public AccountManager()
        {
            Accounts = new List<Account>();
        }
    
        public List<Account> Accounts { get; set; }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having problems figuring out how to fix this error. The following code snippet
I am having some problems figuring out this issue. I have a server that
Having problems figuring this out. trying to do a rescue_from NoMethodError, :with => :try_some_options
I guess this is a silly question, but I'm having problems figuring this out.
I'm studying to take the Security+ exam. I'm really having problems figuring out this
I'm having problems figuring out a query for this scenario. I have two tables
Having some problems figuring out the regex to match this: function Array() { [native
I am having problems figuring out why IE8 doesn't like this: //get all checked
I'm having problems figuring out how to do this. I have two instances (source
I'm having some problems figuring out a solution to this problem. I want to

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.