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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T04:42:37+00:00 2026-06-16T04:42:37+00:00

So this particular topic has been beaten to death; but apparently my iteration is

  • 0

So this particular topic has been beaten to death; but apparently my iteration is either not the method of choice or isn’t practical for implementation.

The goal is to create a Windows Form and a Web Form. Those two forms; set a property in a separate class. Then other classes reference the container; that way as the interface is changed the functionality will change without a lot of recoding.

Windows Form —> Container <— Web Form
Container –> Referenced by these: Class 1, Class 2, Class 3

I approached it like this:
Form:

private Some.Reference.ToClass.Container _container;
public void Method(Some.Reference.ToClass.Container Container)
{
          _container = Container;
}

private void button_click(object sender, EventArgs e)
{
          _container.Name = textbox.Text (or some other component)
}

Class: “Container”

public Name { get; set; }

Class or Form to Reference:

Class WhateverName
{
       private string REFERENCE;

       private Some.Reference.ToClass.Container _container;
       public void Method(Some.Reference.ToClass.Container Container)
       {
                _container = Container;
       }

       public void NewMethod()
       {
              REFERENCE = _container.Name;
       }
}

It continually doesn’t set; it states it’s a null object. What am I missing? Any help would be appreciated. Or even a nice tutorial for me to compare to learn; or find why it doesn’t work would be fine as well.

  • 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-16T04:42:39+00:00Added an answer on June 16, 2026 at 4:42 am

    Based on the details provided; including the issue with the null value. I set a Constructor to automatically initialize based upon the change. Then just added some null reference check.

    An example of this resolution:

    public class One
    {
    
        // declared:
        private.some.Reference.ToSomeClass _container;
    
        One(ToSomeClass container)
        {
              _container = container;
        }
    
        private void button_click(object sender, EventArgs e)
        {
              if(_container != null)
              {
                   _container.Name = textbox.Text (or some other component)
              }
        }
    }
    

    Then in the other class; it references the Property; for it to be set. So to avoid it failing cause a value hasn’t been assigned yet or an instance hasn’t been created just added a null reference verification.

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

Sidebar

Related Questions

I know this topic has been approached several times before in various ways, but
i know this topic has been discussed here before but i still can't get
This particular topic has some answers on SO, but none of them solves my
Apologize if this particular problem has been answered already (a search didn't turn anything
This particular topic has always made me wonder is there a more efficient way
In this particular code sample I want to reference the second overloaded method (int
I know there are a lot of posts related to this particular error but
I'm not quite sure how to go about styling this particular bit of php:
This is an easy question but I am not sure the correct jargon to
I realise this is a big topic, but I'd appreciate some rough ideas on

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.