Search code examples
c#winformsdatagridviewdata-annotationssystem.componentmodel

ComponentModel's Browsable false doesn't work for specific model


I have DataGridView and I display different tables. Everything worked fine but I had to update my Entity Framework model and it reset all my model classes. Now only one class still displays ID Column and other ones hide it. I can't see any difference in this class than other ones.

namespace KasaMP.OsnovniPodaci
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;

public partial class Artikl
{
    [Browsable(false)]
    public int IDArtikli { get; set; }
    public string Barkod { get; set; }
    public Nullable<int> Sifra { get; set; }
    public string Naziv { get; set; }
    public string JedinicaMjere { get; set; }
    public decimal Tarifa { get; set; }
    public Nullable<decimal> ProdajnaCijena { get; set; }
    [Browsable(false)]
    public Nullable<bool> Flag { get; set; }
    public Nullable<decimal> Kalo { get; set; }
    public Nullable<decimal> NabavnaCijena { get; set; }
    public Nullable<decimal> VeleprodajnaCijena { get; set; }
    public Nullable<decimal> Zalihe { get; set; }
}
}

enter image description here

Other model classes perfectly hide it, what's going on?

namespace KasaMP.OsnovniPodaci
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;

    public partial class Porez
    {
        [Browsable(false)]
        public int IDPorez { get; set; }
        public decimal Tarifa { get; set; }
        public decimal Porez1 { get; set; }
        public decimal PorezUsluge { get; set; }
        public decimal PorezPotrosnje { get; set; }
    }
}

enter image description here

I use the same Form and the same DatagridView control to display this - why is Visual Studio discriminating my Artikl class :C


Solution

  • OK, turn out it's probably some Visual Studio/cache bug, I'm not sure...

    but it suddenly - magically - works now...

    Unfortunatelly I can't write a better answer