I want to add data into ListBox from TextBox in a dialog box but I can not

- Code: Select all Expand viewCollapse view
Sub Main
DialogLibraries.LoadLibrary("Standard")
oDlg = CreateUnoDialog(DialogLibraries.Standard.Dialog1 )
oDlg.execute()
End Sub
Sub AddButton
dim textbox,listbox as object
textbox=oDlg.getControl(TextField1)
listbox=oDlg.getControl(ListBox1)
listbox.additem(textbox.Text, 0) REM this does not work
End Sub
when i add this controls on document they are work but they dont work on dialog box
thanks for your help