In a project I have something similar to this, it's just an example, if it's not loaded the B4XComboBox gives error (in B4A it works) I have to use Try EndTry instead of IsInitialized
B4X:
Dim Lista As List = Array("aa", "bb", "cc")
Dim Seleccion As String
#If B4a
Seleccion = B4XComboBox1.SelectedItem
#Else If B4i
'1st option
If B4XComboBox1.IsInitialized Then
Seleccion = B4XComboBox1.SelectedItem
Else
Seleccion = ""
End If
'2nd option
' Try
' Seleccion = B4XComboBox1.SelectedItem
' Catch
' Seleccion = ""
' Log(LastException)
' End Try
#End If
B4XComboBox1.SetItems(Lista)
B4XComboBox1.SelectedIndex = Max(B4XComboBox1.IndexOf(Seleccion), 0)