Is it possible to change the text of a PopupMenu’s selected row?
If the PopupMenu’s text is currently, “Option1” - is it possible to change it to “Option1a” - without having to delete all rows and then repopulate it?
I tried the code below - but I get an error saying “cannot assign a value to this property” :
Window1.PopupMenu1.text = Window1.PopupMenu1.text + "a"
Looking at the documentation for PopupMenu, the Text property is read only. You will have to remove all the rows, repopulate with the updated item, and reselect it with ListIndex.
It seems possible to use removerow and insertrow to change a particular option.
I do not want to delete all rows and then repopulate, and I don’t think removeRow and insertRow will cause the popupmenu entries to stay in exactly the same order (but with a replaced row)?
I suppose that would work too
RemoveRow and InsertRow, still requires the popupmenu to be repopulated
I need something like ReplaceRow (but it doesn’t exist)
Yeah right. The Earth is flat
It does. Just checked now
In a module :
Sub ReplaceRow(Extends popmenu as PopupMenu, RowNumber as Integer, Item as String)
if RowNumber > popmenu.ListCount or RowNumber < 0 then return
Example of use :
if PopupMenu1.ListIndex >=0 then PopupMenu1.ReplaceRow(PopupMenu1.ListIndex,"Boo !")
Nice one Mr Budjardet - I will try that later when I’m back at my computer.
Thank you for your help - much appreciated.
if RowNumber > popmenu.ListCount or ...
This should be >=