### Convert a List into Array of Objects

To convert a List into an Array of Objects, define an Object Array and assign the list items.
' Create the List
Dim l As List
' Assign list values
l.Initialize
l.AddAll(Array As String("A","B","C"))
' Create the object array with list size
Dim o(l.Size) As Object
' Assign the list items to the object array
For i = 0 To l.Size - 1
o(i) = l.Get(i)
Next
Use the Array of Object.
Example showing InputDialog using the Java Swing Library
The Java Swing showInputDialog Method requires a Array of Object when showing options to select from.
' Parameter Input Message
' Parameter Dialog Title
' Parameter Inputtype, like Info etc. Use 2 as default
' Parameter Options to select from
`Public Sub showInputDialog(strMsg As String, strTitle As String, nType As Int, l As List)
' Convert the list into an array of objects
Dim o(l.Size) As Object
For i = 0 To l.Size - 1
o(i) = l.Get(i)
Next
' Define the JavaObject
Dim jo As JavaObject
' Initialize using the Swing Library class JOptionPane
jo.InitializeStatic("javax.swing.JOptionPane")
Dim strInput As String = jo.RunMethod("showInputDialog", Array As Object(Null, strMsg, strTitle, nType, Null, o, Null))
Log("showInputDialog: " & strInput)
End Sub`

Changed: , Category: Objects, File: T6C227M1676.htm, ID: 1676