Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. Can't access classes/objects?

Can't access classes/objects?

Scheduled Pinned Locked Moved ASP.NET
csharpquestionasp-netvisual-studiolinq
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Arcdigital
    wrote on last edited by
    #1

    Hey, can you guys help me out with this real quick? I have 2 projects (in 1 solution, both .net 3.5) they are ZZZ.Objects and ZZZ.WebUI, the ZZZ.WebUI project contains a reference to ZZZ.Objects. ZZZ.Objects is a class library project, and ZZZ.WebUI is an asp.net web application project I created a new class file in the objects project, it contains (and of course the using, namespace, etc...) public class User { public string FirstName { get; set; } public string LastName { get; set; } } Then in the Web Application I created a file (test.cs) and I put this exact code in it. using System; using System.Collections.Generic; using System.Linq; using System.Web; using ZZZ.Objects; namespace ZZZ.WebUI { public class Test1 { User myUser = new User(); } } I can't set any properties for myUser! It just pops up with nothing in intellisense, and errors if I try to compile with it manually typed. What is going on?? If I try to instantiate the User Class from a file inside the objects project it works fine! Please help :((

    B A 2 Replies Last reply
    0
    • A Arcdigital

      Hey, can you guys help me out with this real quick? I have 2 projects (in 1 solution, both .net 3.5) they are ZZZ.Objects and ZZZ.WebUI, the ZZZ.WebUI project contains a reference to ZZZ.Objects. ZZZ.Objects is a class library project, and ZZZ.WebUI is an asp.net web application project I created a new class file in the objects project, it contains (and of course the using, namespace, etc...) public class User { public string FirstName { get; set; } public string LastName { get; set; } } Then in the Web Application I created a file (test.cs) and I put this exact code in it. using System; using System.Collections.Generic; using System.Linq; using System.Web; using ZZZ.Objects; namespace ZZZ.WebUI { public class Test1 { User myUser = new User(); } } I can't set any properties for myUser! It just pops up with nothing in intellisense, and errors if I try to compile with it manually typed. What is going on?? If I try to instantiate the User Class from a file inside the objects project it works fine! Please help :((

      B Offline
      B Offline
      Brij
      wrote on last edited by
      #2

      I think ,You must've added the refence of that class library project.There is namespace problem.Try with using full namespace at the tome of creating the object as ZZZ.Objects.User myUser = new ZZZ.Objects.User();

      Cheers!! Brij

      A 1 Reply Last reply
      0
      • A Arcdigital

        Hey, can you guys help me out with this real quick? I have 2 projects (in 1 solution, both .net 3.5) they are ZZZ.Objects and ZZZ.WebUI, the ZZZ.WebUI project contains a reference to ZZZ.Objects. ZZZ.Objects is a class library project, and ZZZ.WebUI is an asp.net web application project I created a new class file in the objects project, it contains (and of course the using, namespace, etc...) public class User { public string FirstName { get; set; } public string LastName { get; set; } } Then in the Web Application I created a file (test.cs) and I put this exact code in it. using System; using System.Collections.Generic; using System.Linq; using System.Web; using ZZZ.Objects; namespace ZZZ.WebUI { public class Test1 { User myUser = new User(); } } I can't set any properties for myUser! It just pops up with nothing in intellisense, and errors if I try to compile with it manually typed. What is going on?? If I try to instantiate the User Class from a file inside the objects project it works fine! Please help :((

        A Offline
        A Offline
        Abhijit Jana
        wrote on last edited by
        #3

        Arcdigital wrote:

        ZZZ.Objects is a class library project

        Arcdigital wrote:

        ZZZ.WebUI is an asp.net web application project

        Did you add , ZZZ.Object as Reference to the ZZZ.WebUI In WebUI , Right Click on reference -> Add Reference-> Go to Project Tab -> Now add ZZZ.Object Class Library. :~

        cheers, Abhijit

        1 Reply Last reply
        0
        • B Brij

          I think ,You must've added the refence of that class library project.There is namespace problem.Try with using full namespace at the tome of creating the object as ZZZ.Objects.User myUser = new ZZZ.Objects.User();

          Cheers!! Brij

          A Offline
          A Offline
          Arcdigital
          wrote on last edited by
          #4

          Hmm...Still doesn't work when I try using the full namespace. Yes, I added the reference to the class library project in my webapp project. Here is the exact code... In Project ZZZ.WebApp.Objects - File User.cs using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ZZZ.WebApp.Objects { public class User { public string FirstName { get; set; } public string LastName { get; set; } } } In Project ZZZ.WebApp.WebUI - File Test1.cs using System; using System.Collections.Generic; using System.Linq; using System.Web; using ZZZ.WebApp.Objects; //Also Referenced In The Project File namespace ZZZ.WebApp.WebUI { public class Test1 { ZZZ.WebApp.Objects.User myUser = new ZZZ.WebApp.Objects.User(); myUser. //THIS DOESN'T WORK!! There is no intellisense and it says type name expected, but field name found } }

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups