What property do you find the selected list item of a listbox in base basic

I am having multiple troubles with a list box. I stop the programme and check the properties. What is the correct method. I find sometimes the properties are empty, but usually it shows the one you have as default regardless of the item clicked on. There are only 4 items in the list. I just need to get reliable the name or number. thankyou for any help.
Dim Clean as Cleanup,a as string
dim oform as object, ofield as object
oForm = ThisComponent.Drawpage.Forms.getByName(“Form”) ‘Get Form’
oField = oForm.getByName(“DIY”) ‘Get access to field’
a=ofield.SelectedValue
Select Case ofield.SelectedValue
Case “D.I.Y.”
I have also used string variable in select case.
summary. Usually it only returns the one listed as “Default”. If I have more than one or none it returns empty.

Have a look at the Base Guide, special Macros → Listbox.

Thankyou. Good reference work, will help a lot

The solution turned out to be simple. I changed the Event calling the sub from “On mouse click” to “Item Status Changed”.