【问题标题】:ComponentModel's Browsable false doesn't work for specific modelComponentModel 的 Browsable false 不适用于特定模型
【发布时间】:2017-02-22 09:15:29
【问题描述】:

我有 DataGridView 并显示不同的表。一切正常,但我必须更新我的实体框架模型并重置我所有的模型类。现在只有一个类仍然显示 ID 列,其他类隐藏它。我看不出这个班和其他班有什么不同。

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; }
}
}

其他模型类完美隐藏,这是怎么回事?

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; }
    }
}

我使用相同的 Form 和相同的 DatagridView 控件来显示这个 - 为什么 Visual Studio 会区分我的 Artikl 类:C

【问题讨论】:

    标签: c# winforms datagridview data-annotations system.componentmodel


    【解决方案1】:

    好吧,原来这可能是一些 Visual Studio/缓存错误,我不确定...

    但它突然——神奇地——现在起作用了……

    很遗憾,我写不出更好的答案

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-06-24
      • 2020-12-31
      • 2015-08-30
      • 2012-03-13
      • 1970-01-01
      • 2017-04-13
      • 2022-01-25
      • 2021-06-05
      相关资源
      最近更新 更多