I use a type to store info. and add that to a list
B4X:
Type ProductsInfo(Id As Long, Name As String, MyButton as object)
Dim SalesList As List
For i = 0 to 10
Dim Cur_prod as ProductsInfo
cur_prod.id = i
saleslist.add(Cur_Prod)
next
Works fine
But when I change the Type declaration with "MyButton as button" like
B4X:
Type ProductsInfo(Id As Long, Name As String, MyButton as Button)
Dim SalesList As List
For i = 0 to 10
Dim Cur_prod as ProductsInfo
cur_prod.id = i
saleslist.add(Cur_Prod)
next
I get an error/warning "Object expected" How Can I solve this?
Adding Cur_Prod.myButton = null does not work. please advice
Dim SalesList As List
SalesList.Initialize
For i = 0 To 10
Dim Cur_prod As ProductsInfo
Cur_prod.Initialize
Cur_prod.id = i
SalesList.add(Cur_prod)
Next
I did not mention that the code above is in a "codemodule"
One can't declare objects explicitly in a code module.
I moved the "type" and "list" declarations to an "activity module"
The problem is solved.