需实现选择耗材型号自动改变物料规则和供应商
在选择耗材型号后发现更改也无法改变物料规则和供应商,发现是Item的值一直叠加,所以取0总是取得第一次的,所以清空item后再赋值就变了
private void cobGlueType_SelectedIndexChanged(object sender, EventArgs e)
{
string strMatType = this.cmbMatType.Text.Trim();
if (this.cmbMatType.SelectedIndex >= 0)
{
DataTable dt = conn.GetGMRule(strMatType);
foreach (DataRow item in dt.Rows)
{
this.cmbMatRule.Items.Clear();
this.cmbVendor.Items.Clear();
this.cmbMatRule.Items.Add(item["RULENAME"]);
this.cmbVendor.Items.Add(item["GLUEVENDOR"]);
cmbMatRule.SelectedIndex = 0;
cmbVendor.SelectedIndex = 0;
this.dtpEndTime.Value = dtpStartTime.Value.AddDays(Convert.ToInt32(item["EFFECTIVE_DAYS"]));
}
}
}
清空下拉框item中的值
this.cmbMatRule.Items.Clear();
this.cmbVendor.Items.Clear();