I have a problem with a combobox and an arraylist, allocate a numerical value to each of the items of the combobox, and a button to allocate combobox value in -1 (ComboBox1. SelectedIndex = -1)
but it returns me error:
ComboBox1. SelectedIndex = -1
Error description: NullReferenceException
Continue?
This happens only on having pressed Reset Button, whit a ComboBox1. SelectedIndex <>-1.
Which is the solution to this problem?
Thanks!
B4X:
Sub Globals
'Declare the global variables here.
End Sub
Sub App_Start
Form1.Show
ArrayList1.Add(1)
ArrayList1.Add(1)
ArrayList1.Add(2)
ArrayList1.Add(3)
ArrayList1.Add(4)
ArrayList1.Add(5)
End Sub
Sub ComboBox1_SelectionChanged (Index, Value)
Label2.Text = ArrayList1.Item(Index)
End Sub
Sub Button1_Click
ComboBox1.SelectedIndex=-1
End Sub
but it returns me error:
ComboBox1. SelectedIndex = -1
Error description: NullReferenceException
Continue?
This happens only on having pressed Reset Button, whit a ComboBox1. SelectedIndex <>-1.
Which is the solution to this problem?
Thanks!