![]() |
MSForms 2.0 Combobox problem
I'm working on a project that runs inside Excel. When a user clicks on an
excel Cell, an MSForms 2.0 Combobox is created through code in c++, and placed over that cell. The dropdown portion is populated with a list of possible choices, all of which happen to be other cells on the same sheet, but the user is free to type their own string into the combobox, too. The combobox is linked to the excel cell through _OleObject-put_LinkedCell, to keep the value of the cell and the combobox synchronized at all times. When the user leaves the cell, the combobox is hidden, leaving the cell displayed with the value from the combobox. The problem is that when I click on a cell with an existing string, and I edit it such that the string now matches one of the choices in the dropdown list, then when I leave that cell, the new value typed is never sent to the cell. If I edit the string such that a string that is NOT in the dropdown list is created and then leave the cell, the new string appears in the cell once the combobox is hidden. Illustrated example (working case): -combobox contains "Entry1, Entry2, .... Entry15." -User clicks on a cell that says "Entry1" and the combobox is made visible. The combobox text says "Entry1". -User types a "6" at the end, to make the string "Entry16." -User leaves cell, and the combobox is hidden, leaving the cell displayed with the value "Entry16" (bad case) -combobox contains "Entry1, Entry2, .... Entry15." -User clicks on a cell that says "Entry1" and the combobox is made visible. The combobox text says "Entry1". -User types a "5" at the end, to make the string "Entry15." -User leaves cell, and the combobox is hidden, leaving the cell displayed with the value "Entry1" Any suggestions would be greatly appreciated. thanks! -M |
MSForms 2.0 Combobox problem
I should add, too, that if I turn off the combobox's Autocomplete
functionality, this problem goes away. Unfortunately, autocomplete was a big reason the comboboxes were used in the first place, and turning it off is not an option. "MTC75" wrote: I'm working on a project that runs inside Excel. When a user clicks on an excel Cell, an MSForms 2.0 Combobox is created through code in c++, and placed over that cell. The dropdown portion is populated with a list of possible choices, all of which happen to be other cells on the same sheet, but the user is free to type their own string into the combobox, too. The combobox is linked to the excel cell through _OleObject-put_LinkedCell, to keep the value of the cell and the combobox synchronized at all times. When the user leaves the cell, the combobox is hidden, leaving the cell displayed with the value from the combobox. The problem is that when I click on a cell with an existing string, and I edit it such that the string now matches one of the choices in the dropdown list, then when I leave that cell, the new value typed is never sent to the cell. If I edit the string such that a string that is NOT in the dropdown list is created and then leave the cell, the new string appears in the cell once the combobox is hidden. Illustrated example (working case): -combobox contains "Entry1, Entry2, .... Entry15." -User clicks on a cell that says "Entry1" and the combobox is made visible. The combobox text says "Entry1". -User types a "6" at the end, to make the string "Entry16." -User leaves cell, and the combobox is hidden, leaving the cell displayed with the value "Entry16" (bad case) -combobox contains "Entry1, Entry2, .... Entry15." -User clicks on a cell that says "Entry1" and the combobox is made visible. The combobox text says "Entry1". -User types a "5" at the end, to make the string "Entry15." -User leaves cell, and the combobox is hidden, leaving the cell displayed with the value "Entry1" Any suggestions would be greatly appreciated. thanks! -M |
All times are GMT +1. The time now is 11:52 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com