有combox控件,命名为cbxPutStatus,在程序中为其手工定义数据源,并绑定
privatevoid POrderSplitFrm_Load(object sender, EventArgs e)
{
//绑定定单状态
this.cbxPutStatus.DataSource = DataTableForPutStatus();
this.cbxPutStatus.DisplayMember = "PutStatusString";
this.cbxPutStatus.ValueMember = "POrderApproveStatus";
this.cbxPutStatus.SelectedIndex = 0
}
privateDataTable DataTableForPutStatus()
{
DataTable dt = newDataTable();
dt.Columns.Add("PutStatusString");
dt.Columns.Add("POrderApproveStatus");
//定义定单状态 0:未发布;1:已发布;2:所有状态
dt.LoadDataRow(newobject[] { "待发布", "0" }, true);
dt.LoadDataRow(newobject[] { "已发布", "1" }, true);
dt.LoadDataRow(newobject[] { "所有状态", "2" }, true);
return dt;
}