How to fix Error - member names cannot be the same as their enclosing type

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Ravikant Varma

    How to fix Error - member names cannot be the same as their enclosing type

    Code:
    public partial class frmStoreMaster
            {
    
                private void FillData(string StoreID)
                {
    
                    DAStoreMaster objStoreMst = new DAStoreMaster();
    
                    try
                    {
                        StoreInfo objStoreInfo = new StoreInfo();
                        objStoreInfo.StoreID = Convert.ToInt32(StoreID);
                        objStoreInfo.StoreName = "";
                        objStoreInfo.ContactPerson = "";
    
    
                        DataTable dt_StoreInfo = objStoreMst.GetStoreInfo(objStoreInfo);
    
                        txtStoreName.Text = dt_StoreInfo.Rows[0]["Store_Name"].ToString();
                        ddlFKStoregroup.SelectedValue = dt_StoreInfo.Rows[0]["FK_Store_group"].ToString();
                        txtContactPerson.Text = dt_StoreInfo.Rows[0]["Contact_Person"].ToString();
                        txtComments.Text = dt_StoreInfo.Rows[0]["Comments"].ToString();
    
    
                    }
                    catch (Exception ex)
                    {
                        throw (ex);
                    }
                    finally
                    {
                        objStoreMst = null;
                    }
                }
  • mldisibio
    Recognized Expert New Member
    • Sep 2008
    • 191

    #2
    That error comes from having a property with the same name as the Class to which it belongs.

    The code you posted does not have any properties or fields, so you need to look more carefully at the error message to find which class, which file, which line it is referring to.

    Comment

    Working...