private void gvDetail_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex >= 0) { SelectedData = gvDetail.GetDataBound(e.RowIndex) as sp_MAS_DialogCustomerLocation_Result; this.DialogResult = DialogResult.OK; } }
private void txtSearch_TextChanged(object sender, EventArgs e) { string txt = txtSearch.Text.ToUpper(); var result = clocList.Where(x => x.LOC_NAME_LV3.GetValueOrDefault().ToUpper().Contains(txt) || x.LOC_NAME_LV2.GetValueOrDefault().ToUpper().Contains(txt) || x.LOC_NAME.GetValueOrDefault().ToUpper().Contains(txt)).ToList(); gvDetail.DataSource = new SortableBindingList <sp_MAS_DialogCustomerLocation_Result>(result); if (result.Count == 1) { SelectedData = result[0]; } else { SelectedData = null; } }