P pobss Member Licensed User Longtime User Mar 26, 2012 #1 hi, how can i use "public property" of vb.net in code activity? tanks
klaus Expert Licensed User Longtime User Mar 26, 2012 #2 What exactly do you want to do? What kind of public properties are you speaking of ? Variables can be public when declared in Process_Globals. Best regards. Upvote 0
What exactly do you want to do? What kind of public properties are you speaking of ? Variables can be public when declared in Process_Globals. Best regards.
P pobss Member Licensed User Longtime User Mar 26, 2012 #3 I would like to pass a property from Activity module (eg ListView) to the code module where we will be the code to populate it. Upvote 0
I would like to pass a property from Activity module (eg ListView) to the code module where we will be the code to populate it.
P PaulR Active Member Licensed User Longtime User Mar 26, 2012 #4 You can do that by passing the argument in a Sub in the Code Module (called CodeModule here).... B4X: Sub DoStuff(lv As ListView) 'do stuff with lv here End Sub .... and in your activity.... B4X: CodeModule.DoStuff(lv) .... you don't need to return lv because objects are passed by reference so lv will be updated in the Activity you called the Sub from. That's what I'm doing anyway. Points to me for effort. Upvote 0
You can do that by passing the argument in a Sub in the Code Module (called CodeModule here).... B4X: Sub DoStuff(lv As ListView) 'do stuff with lv here End Sub .... and in your activity.... B4X: CodeModule.DoStuff(lv) .... you don't need to return lv because objects are passed by reference so lv will be updated in the Activity you called the Sub from. That's what I'm doing anyway. Points to me for effort.
P pobss Member Licensed User Longtime User Mar 27, 2012 #5 thanks is what I do right now. But I would have many arguments to the sub and becomes very long. so I tried a more simple and clean as public property of vb if possible, otherwise continuing with sub. thanks Upvote 0
thanks is what I do right now. But I would have many arguments to the sub and becomes very long. so I tried a more simple and clean as public property of vb if possible, otherwise continuing with sub. thanks
P PaulR Active Member Licensed User Longtime User Mar 27, 2012 #6 You could create an object or two containing all the different data types including objects and arrays of objects to clean it up a bit..... B4X: Type MyObject(lv As ListView, alv(20) As ListView, blah As float) Dim mo As MyObject 'fill up object(s) with exciting things CodeModule.DoStuff(mo) Upvote 0
You could create an object or two containing all the different data types including objects and arrays of objects to clean it up a bit..... B4X: Type MyObject(lv As ListView, alv(20) As ListView, blah As float) Dim mo As MyObject 'fill up object(s) with exciting things CodeModule.DoStuff(mo)