'this of course breaks but, it's similar to what I would like to do. Sel Text = "Inbound" I understand I can just use the index "0" but, I just need the values not the indices themselves. If you had a very large list you'd be best off sorting it and doing the HI-LO / 2 routine ... As a follow-up, I would note that considering all the things that combobox does behind the scenes when you set the text property, that the above hammer approach would almost always be a lot more efficient in addition to not interfering with the GUI needlessly. Is there something as simple as cmb Transaction Type. I would like to try to avoid tracking indices as much as possible since it's extra overhead that isn't necessary for what i'm trying to achieve. I've done this previously in other languages using hashes, and was wondering if there is an easy way to do this? This function will return the index ' // Returns the list index value for the item matching str Search Value ' // in combo box cb Combo Box ' // Otherwise returns -1 if not found Public Function Find CBIndex(By Ref cb Combo Box As Combo Box, By Ref str Search Value As String) As Integer Dim n As Integer For n = 0 To cb Combo Box. List(n) = str Search Value Then ' // Return the found index Find CBIndex = n ' // and exit Exit Function End If Next ' // Set not found value Find CBIndex = -1 End Function Private Sub Command1_Click() Combo1. For a long time now I have been trying to fix a problem with a combobox (it givs me headaches when I think at how many tests and forums I've tried). I know that after a combobox has been "binded" to a source it will be synchronised with it(every change will appear in combobox). New Index) = 67890 End Sub Private Sub Combo1_Click() Label1. Those properties, methods, and events that have the same name and behavior are not listed.
If the contents of the collection is a Type (Class), changes to one of the properties will not automatically show up without another special step.
If you had a very large list you'd be best off sorting it and doing the HI-LO / 2 routine ...
Add Item "Foghat" Msg Box Find CBIndex(Combo1, "Black Sabbath") End Sub As a follow-up, I would note that considering all the things that combobox does behind the scenes when you set the text property, that the above hammer approach would almost always be a lot more efficient in addition to not interfering with the GUI needlessly.
I need to get value that has been selected from combobox ..
Hello all, Is it possible to grab the index of an item in the combobox by just knowing the value? If your ultimate goal is to only find the index, then setting the text value is a bad idea: user hostile.