gruizelgruis Member Licensed User Longtime User Jun 19, 2015 #1 Hi all, I use a type to store info. and add that to a list Code: Copy 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 Code: Copy 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
Hi all, I use a type to store info. and add that to a list Code: Copy 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 Code: Copy 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
LucaMs Expert Licensed User Longtime User Jun 19, 2015 #2 Code: Copy 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 Upvote 0
Code: Copy 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
gruizelgruis Member Licensed User Longtime User Jun 19, 2015 #3 @LucaMs I'm sorry I forgot to mention the ".initialize" I do use initialize in my code. Just forgot to put it up in here. Upvote 0
@LucaMs I'm sorry I forgot to mention the ".initialize" I do use initialize in my code. Just forgot to put it up in here.
LucaMs Expert Licensed User Longtime User Jun 19, 2015 #4 Cur_prod.Initialize solves the problem. Upvote 0
gruizelgruis Member Licensed User Longtime User Jun 20, 2015 #5 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. Upvote 0
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.