private void cmbPartName_SelectedIndexChanged(object sender, EventArgs e) { ClearAllDGVData(); if (ableLoadCodeData) { string keywords = cmbPartName.Text; if (!string.IsNullOrEmpty(keywords)) { DataTable dt = dalItem.nameSearch(keywords); DataTable dtItemCode = dt.DefaultView.ToTable(true, "item_code"); dtItemCode.DefaultView.Sort = "item_code ASC"; cmbPartCode.DataSource = dtItemCode; cmbPartCode.DisplayMember = "item_code"; if (dtItemCode.Rows.Count > 1) { cmbPartCode.SelectedIndex = -1; } } else { cmbPartCode.DataSource = null; } } }
private void cmbParentName_SelectedIndexChanged(object sender, EventArgs e) { errorProvider2.Clear(); string keywords = cmbParentName.Text; if (!string.IsNullOrEmpty(keywords)) { DataTable dt = dalItem.nameSearch(keywords); cmbParentCode.DataSource = dt; cmbParentCode.DisplayMember = "item_code"; cmbParentCode.ValueMember = "item_code"; } else { cmbParentCode.DataSource = null; } updateTestName(); }
private void cmbName_SelectedIndexChanged(object sender, EventArgs e) { string keywords = cmbName.Text; if (!string.IsNullOrEmpty(keywords)) { DataTable dt = dalItem.nameSearch(keywords); cmbCode.DataSource = dt; cmbCode.DisplayMember = "item_code"; cmbCode.ValueMember = "item_code"; } else { cmbCode.DataSource = null; } }
private void loadItemCodeData() { string keywords = cmbItemName.Text; if (!string.IsNullOrEmpty(keywords)) { DataTable dt = dalItem.nameSearch(keywords); DataTable dtItemCode = dt.DefaultView.ToTable(true, "item_code"); dtItemCode.DefaultView.Sort = "item_code ASC"; cmbItemCode.DataSource = dtItemCode; cmbItemCode.DisplayMember = "item_code"; } else { cmbItemCode.DataSource = null; } }