Boj*_*ojo 10 c# datagridview visual-studio-2010
在我的Windows窗体上,我有一个DataGridView组件,它绑定到BindingSource.BindingSource是EntityFramework对象的对象数据源.
有时我的DataBridView中的列会被更新.有时,所有属性都会添加为列,但现在它也会删除所有列.所以我丢失了所有设置.
什么时候列自动添加?
(我正在使用VS.NET 2010)
更新:
//
// Summary:
// Gets or sets a value indicating whether columns are created automatically
// when the System.Windows.Forms.DataGridView.DataSource or System.Windows.Forms.DataGridView.DataMember
// properties are set.
//
// Returns:
// true if the columns should be created automatically; otherwise, false. The
// default is true.
[Browsable(false)]
[EditorBrowsable(EditorBrowsableState.Advanced)]
[DefaultValue(true)]
public bool AutoGenerateColumns { get; set; }
Run Code Online (Sandbox Code Playgroud)
该属性未显示在设计器中,并且未检查"隐藏高级属性".
更新2:当我更新我的实体框架模型时,将再次添加所有列.我只能在表单的构造函数中设置属性.这非常烦人.
添加此代码或将DataGridView属性更改AutoGenerateColumns
为false
DataGridView1.AutoGenerateColumns=false;
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
18353 次 |
最近记录: |