954,518 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Get ValueMembers from a ComboBox in a new array?

I have a databound combobox and I need to get all of the ValueMember values from each item in the combobox. I'd prefer to not change the selected item in the combobox to do this, since each time the item in the combobox changes a few events are triggered that wouldn't need to be.

Is there a way to just get the array of ValueMembers without a loop?

zachattack05
Posting Pro
516 posts since Dec 2009
Reputation Points: 61
Solved Threads: 15
 

I have a databound combobox and I need to get all of the ValueMember values from each item in the combobox. I'd prefer to not change the selected item in the combobox to do this, since each time the item in the combobox changes a few events are triggered that wouldn't need to be.

Is there a way to just get the array of ValueMembers without a loop?

Nevermind, unless someone has a better solution, this seems to work:

foreach (DataRowView x in theDataBindingSource.List)
            {
                int xx = (int)x["MyValueMemberColumn"];
                // Do Stuff...
            }
zachattack05
Posting Pro
516 posts since Dec 2009
Reputation Points: 61
Solved Threads: 15
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You