Thanks for replying, both of you. At my level I would never have worked that out!
However, I have tried both constructs.
Hanya's
Code: Select all
Private Sub ListBox1_Click()
d = CreateUnoDialog( DialogLibraries.Standard.Dialog1) 'Load the existing Dialog called Dialog1
d.execute()
d.getModel().getByName("TextField2").EnableVisible = False
d.getModel().getByName("TextField1").EnableVisible = True
d.getModel().getByName("TextField1").Text = _ d.getModel().getByName("ListBox1").StringItemList(d.getModel().getByName("ListBox1").SelectedItems(0)) ' **
End Sub
produces 'Index out of defined range' (there are 4 items in Listbox1) at the starred line,
and Arineckaig
Code: Select all
Private Sub ListBox1_Click()
d = CreateUnoDialog( DialogLibraries.Standard.Dialog1) 'Load the existing Dialog called Dialog1
d.execute()
Dim i
Dim TargetTxt
i = d.getModel().getByName("ListBox1").SelectedItems(0) ' **
TargetTxt = d.getModel().getByName("ListBox1").StringItemList(i)
d.getModel().getByName("TextField1").Text =TargetTxt
End Sub
produces the same 'Index out of defined range' at the starred line
I have presumably missed a step or two? It would be very useful to know where I can find this information
I suspect the difficulty you are having is that the properties and methods for a list box in a dialog differ from those of a list box contained in a data form.