private string LIMSListKey; // Current LIMSList selection. public BioSeqLIMSEdit() { InitializeComponent(); btnOK.Enabled = false; btnApply.Enabled = false; Cursor.Current = Cursors.WaitCursor; LIMSBaseList = ServiceCallHelper.ReadLIMSData(AppConfigHelper.LoggedOnUser, AppConfigHelper.JsonConfig()); LIMSList = new Dictionary <string, string>(); foreach (string key in LIMSBaseList.Keys) { LIMSList.Add(LIMSBaseList[key], key); } lstSampleIDs.Items.Clear(); lstSampleIDs.Items.AddRange(ServiceCallHelper.SampleIDs(AppConfigHelper.LoggedOnUser, AppConfigHelper.JsonConfig()).ToArray()); if (lstSampleIDs.Items.Count > 0) { lstSampleIDs.SetSelected(0, true); lstSampleIDs.ItemCheck -= lstSampleIDs_ItemCheck; for (int i = 0; i < lstSampleIDs.Items.Count; i++) { lstSampleIDs.SetItemChecked(i, LIMSList.ContainsKey(lstSampleIDs.Items[i].ToString())); } lstSampleIDs.ItemCheck += lstSampleIDs_ItemCheck; } Cursor.Current = Cursors.Default; }