locked
Cannot access properties in a public class RRS feed

  • Question

  • Hallo

    Sure I'm missing something simple, but for some reason I cannot access the properties of this class, when hovering over the error the message is cannot access the properties due to it's access level, but the class is public and in reference is correct and in the scope of this project. :-(

    Below is just a snippet of the part of the code:

    using System.Windows.Forms;
    using WCS_Cap.BOL;
    using WCS_Cap.BAL;
    
    namespace WCS_Cap
    {
        public partial class frFurnaceFoundryMain : Form
        {
            DataTable dtFurnData = new DataTable();
            FurnaceInfoBA objFurnace = new FurnaceInfoBA();
            FurnaceInfoBO objFurnSymbols = new FurnaceInfoBO();
            int CastNrID;
            int FurnaceSelectedID = 1;
            int CastSelectedID;        
            int MaterialSourceID = 1;
            int MaterialTypeID = 1;
            float MaterialWeight = 0;
    
            public frFurnaceFoundryMain()
            {
                InitializeComponent();
               
            }
    
     
            private void btnAddMaterial_Click(object sender, EventArgs e)
            {
                objFurnSymbols.LoggedDateTime = //Cannot access these properties.. ???
    
    
    
            }
        }
        
    }
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    
    namespace WCS_Cap.BOL
    {
        public class FurnaceInfoBO
        {
            DateTime LoggedDateTime { get; set; }
            int FurnID { get; set; }
            int CastNrID { get; set; }
            int CastSizeID { get; set; }
            int MaterialSourceID { get; set; }
            int MaterialTypeID { get; set; }
            int MaterialWeight { get; set; }      
        }
    }
    



    labjac

    Sunday, October 21, 2018 6:30 AM

Answers

  • Hallo

    Sorry found the mistake, made the Class public but never the properties.

    Regards,


    labjac

    • Proposed as answer by DerChris88 Sunday, October 21, 2018 5:30 PM
    • Marked as answer by labjac Monday, October 22, 2018 2:48 PM
    Sunday, October 21, 2018 6:32 AM

All replies

  • Hallo

    Sorry found the mistake, made the Class public but never the properties.

    Regards,


    labjac

    • Proposed as answer by DerChris88 Sunday, October 21, 2018 5:30 PM
    • Marked as answer by labjac Monday, October 22, 2018 2:48 PM
    Sunday, October 21, 2018 6:32 AM
  • Hi,

    namespace WCS_Cap.BOL
    {
        public class FurnaceInfoBO
        {
            public DateTime LoggedDateTime { get; set; }
            public int FurnID { get; set; }
            public int CastNrID { get; set; }
            public int CastSizeID { get; set; }
            public int MaterialSourceID { get; set; }
            public int MaterialTypeID { get; set; }
            public int MaterialWeight { get; set; }      
        }
    }

    You already found out that you forgot public in front of your properties. So you should mark your last reply as answer to close this question.

    Greetings, Chris

    Sunday, October 21, 2018 5:34 PM
  • Just a a comment:

    Your class FurnaceInfoBO in its current form is a data transfer object (DTO), not an business object. Cause it does not carry any business logic.

    Sunday, October 21, 2018 5:39 PM
  • Hi,

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

    namespace WCS_Cap.BOL
    {
        public class FurnaceInfoBO
        {
                   public int FurnID { get; set; }
         }
    }
    //
     private void btnAddMaterial_Click(object sender, EventArgs e)
            {
                objFurnSymbols.LoggedDateTime = //Now Can access these properties..

    // See FurnID Definintion properties
                objFurnSymbols.FurnID = 999;
            }

    regards,

    AbdulHakim

    Sunday, October 21, 2018 9:11 PM
  • Hallo

    This is basically just holding the parameters for the names I'm using, The business logic is located in a Class called BAL... 

    But as you probably can see from the code, this is the first time using this architecture so I'm happy for any comments or suggestions. 


    labjac

    Monday, October 22, 2018 2:48 PM