I need help make my Combo Box allow a user to select more than one name (item). How do I do this?
Here is the visual basic code that I need to make changes to.
Code:public async void PopulateRequestorComboBox() { List<GetRequestorInfoModel> requestors = new List<GetRequestorInfoModel>(); RequestorComboBox.Items.Clear(); RequestorUpdateComboBox.Items.Clear(); try { requestors = await FTACaseReset.Controllers.RequestorInfoController.GetAllRequestorInfoes(); requestors = requestors.OrderBy(x => x.DisplayName).ToList(); #region Populate RequestorComboBox ComboboxItem firstRequestor = new ComboboxItem(); firstRequestor.Text = "<-Please select Requestor->"; firstRequestor.Value = 0; RequestorComboBox.Items.Add(firstRequestor); for (int i = 0; i < requestors.Count; i++) { ComboboxItem item = new ComboboxItem(); item.Text = requestors[i].DisplayName; item.Value = requestors[i].RequestorInfoID; RequestorComboBox.Items.Add(item); } if (RequestorComboBox.Items.Count > 0) RequestorComboBox.SelectedIndex = 0; #endregion #region Populate RequestorUpdateComboBox for (int i = 0; i < requestors.Count; i++) { ComboboxItem item = new ComboboxItem(); item.Text = requestors[i].DisplayName; item.Value = requestors[i].RequestorInfoID; RequestorUpdateComboBox.Items.Add(item); } #endregion } catch (Exception ex) { string errorMsg = string.Format("An error has occured in {0}. \nException:\n{1}", "PopulateRequestorComboBox()", ex.Message); MessageBox.Show(errorMsg, "Application Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }




Reply With Quote
