getByIndex; how find index of form field

I would like to use oField = oForm.getByIndex(indexNumber) method instead oField = oForm.getByName("fieldName"). But I can’t find index number of element in my form.

Does anyone know how to find out index number?

Tnx

I don’t think a FormControl would know its own index, and I have no idea in what way the information should actually be useful. Please tell us.
In what way would you identify the FormControl you want to know the index of?

Sub findControlIndexInFormForSelectedControlShape()
REM Assume a control (in fact the hosting shape) is selected in design mode.
sh = ThisComponent.CurrentSelection(0)
fc = sh.Control
fo = fc.Parent
u = fo.Count - 1
For j = 0 To u
  j_fc = fo(j)
  If equalUnoObjects(j_fc, fc) Then Exit For
Next j
Print "This time the selected FormControl had the index " & j
REM I don't know if there is an assertion concerning the stability of index assignment.
End Sub

I thought naively index of field is uniqe value of field. But wrong. It’s just ordinal number.
Why it would be useful? If the index is unique and unchangeable, if from some reason you must change name of form field, methods they use that field, remain usable.