public static void InitCMB_ReasonCode_ByCategoryStep(ComboBox cmd, MES_ReasonCategory reasonCategory, string stepsysid) { cmd.Items.Clear(); cmd.DisplayMember = "DisplayField"; cmd.ValueMember = "ValueField"; wsMDL.IwsMDLClient client = new wsMDL.IwsMDLClient(); try { List<tmdlreasoncode> lstReasonCode = client.GetReasonCodeList_ByCategoryStep( (new BaseForm()).CurrentContextInfo, reasonCategory.ToString(), stepsysid).ToList<tmdlreasoncode>(); var q = from p in lstReasonCode orderby p.reasoncodedesc ascending select p; for (int i = 0; i < q.Count(); i++) { cmd.Items.Add(new ValueInfo() { DisplayField = q.ElementAt(i).reasoncodedesc, ValueField = q.ElementAt(i).reasoncode }); } } catch (Exception ex) { throw ex; } finally { baseForm.CloseWCF(client); } }