Sub Class_Globals
Private Root As B4XView
Private xui As XUI
Private EditText1 As EditText 'add using layout designer
Private Label1 As Label 'add using layout designer
Private B4XComboBox1 As B4XComboBox 'add using layout designer
End Sub
Private Sub B4XPage_Created (Root1 As B4XView)
Root = Root1
Root.LoadLayout("MainPage")
Dim L As List
L.Initialize
Dim ThisYear As Int = DateTime.GetYear(DateTime.Now)
For Y = ThisYear - 110 To ThisYear
L.Add("" & Y) 'combobox expects list of string type, not numeric type
Next
B4XComboBox1.SetItems(L)
B4XComboBox1.SelectedIndex = B4XComboBox1.IndexOf("" & (ThisYear - 30)) 'starting position = age 30
End Sub
Private Sub EditText1_TextChanged (Old As String, New As String)
Dim I As Long = B4XComboBox1.IndexOf(New.Trim.ToLowerCase)
Label1.Text = I
End Sub