Public Property in b4a

pobss

Member
Licensed User
Longtime User
hi,
how can i use "public property" of vb.net in code activity?
tanks
 

pobss

Member
Licensed User
Longtime User
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

PaulR

Active Member
Licensed User
Longtime User
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

pobss

Member
Licensed User
Longtime User
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

PaulR

Active Member
Licensed User
Longtime User
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
Cookies are required to use this site. You must accept them to continue using the site. Learn more…