|
-
Jun 10th, 2019, 08:44 AM
#1
Thread Starter
Member
How do I make my combo box allow user select more than one name
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);
}
}
-
Jun 10th, 2019, 09:32 AM
#2
Re: How do I make my combo box allow user select more than one name
Thread moved from the 'CodeBank VB.Net' forum (which is for you to post working code examples, not questions) to the 'VB.Net' forum
-
Jun 10th, 2019, 01:02 PM
#3
Thread Starter
Member
Re: How do I make my combo box allow user select more than one name
Sir you removed my question but you did not tell me where to post my question. Can you please tell me where to post my question?
-
Jun 10th, 2019, 01:13 PM
#4
Re: How do I make my combo box allow user select more than one name
The question wasn't removed. It was moved to the VB.Net forum, which is where the question should have been posted.
You don't need to post it again since it has been moved for you.
-
Jun 10th, 2019, 01:19 PM
#5
Re: How do I make my combo box allow user select more than one name
As for the question, the combobox doesn't support multi-selection.
You can write you own custom version of a combobox to implement that if it is really necessary.
But usually, if you want multi-selection you would use a Listbox which supports that feature.
-
Jun 11th, 2019, 12:04 PM
#6
Thread Starter
Member
Re: How do I make my combo box allow user select more than one name
Thanks for your input. I will create a ListBox.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|