C#,Winform中为什么设置DataGridViewComboBoxColumn.DisplayMember时会提示出错"
未将对象引用设置到对象的实例"
public Entities.TList<Entities.Products> ProductIdList
{
		get {return this._ProductIdList;}
		set  
		{
		  this._ProductIdList = value;
		  this.uxProductIdDataGridViewColumn.DataSource = null;                   
                   this.uxProductIdDataGridViewColumn.DisplayMember = "ProductName";//这句出错:“未将对象引用设置到对象的实例”,明明:uxProductIdDataGridViewColumn.DisplayMember 值是看的到是为""
                   this.uxProductIdDataGridViewColumn.ValueMember = "ProductId";	
				this.uxProductIdDataGridViewColumn.DataSource = this._ProductIdList;
		}
}
//========请高手指点一二!
------解决方案--------------------你试一试这样写:
public Entities.TList <Entities.Products > ProductIdList
{
get {return this._ProductIdList;}
set  
{
 this._ProductIdList = value;
 this.uxProductIdDataGridViewColumn.DataSource = this._ProductIdList;               
                 this.uxProductIdDataGridViewColumn.DisplayMember = "ProductName";  
                 this.uxProductIdDataGridViewColumn.ValueMember = "ProductId";
}
}
------解决方案--------------------要先设数据源,再操作显示,this.uxProductIdDataGridViewColumn.DataSource =null  
为空,当然会错了