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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T19:27:56+00:00 2026-06-17T19:27:56+00:00

I always get tied up with small things like this… I need to access

  • 0

I always get tied up with small things like this… I need to access an objects properties created in class ‘Login’ from my welcome page class ‘Default’. When I try to reference the class so that I may access the object, VS 2010 doesn’t list it as available like it normally would, and forcing the request just returns an error.

My Login Class is defined like so:

public abstract class Login : System.Web.UI.UserControl
{
   ...
   private void Login_click(object sender, EventArgs e)
   {
      MyObject myObject = new MyObject();
      myObject.property1 = "something";
   }
}

And then i wish to access myObject from my default class, like this:

public class Default : System.Web.UI.Page
{
   ...   
   private void Page_load(object sender, System.EventArgs e)
   {
      string someLocalVar = Login.myObject.property1;
   }
}

Where property1 is a property set in the Login class. This does not work, however, and VS doesn’t even recognize the Login class; instead it treats it as a reserved word of some sort. These two files are in the same project, so that shouldn’t be an issue in the using section. I’ve accessed variables in this manner between other classes before, just not this time for some reason.
Thanks!

  • 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-17T19:27:57+00:00Added an answer on June 17, 2026 at 7:27 pm

    2 things:

    • Your class is abstract
    • Your property is probably not static
    • You don’t actually have a property, it’s a local variable

    You can’t instantiate an instance of an abstract class. The point of an abstract class is to create a class with some shared code that other, similar child classes can inherit. Is there a reason your class is abstract?

    If your property is not static you have to create an instance of your class in order to access the property. (Which, as I describe above, you can’t because it’s abstract). If you make your property static, you could then do Login.MyObject without creating an instance.

    In the code you supplied, your variable is local to the Login_click method, which means even if you created an instance of your class you wouldn’t be able to access it.

    I suggest you pick up a C# book and read up on the fundamentals.

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

Sidebar

Related Questions

It seems like I always get this error on one of my scripts: /Users/amosng/.rvm/gems/ruby-1.9.3-p194/gems/ruby-prof-0.11.2/lib/ruby-prof/profile.rb:25:
I always get values from the database directly to a control like this: Code-behind:
I always get this error when trying to compile my file with Boost::GIL PNG
I want my number to always get rounded up to the closest number like
I tried many things but I always get cannot convert string to membershipuser from
**In any javaProject in eclipse there we always get .classpath file...like <?xml version=1.0 encoding=UTF-8?>
I'm trying to get this running: JAXB interface But I always get the error
I always get confused between the static and dynamic scoping and hence need someone
I always get the undefined index notice, when I run this on wampserver. Tried
Why I always get WSAETIMEDOUT error in this code : var fUDPBuf: array [1..UdpPacketSize]

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.