Android Question is it possible to assign sender to global variable

azclay

Member
Licensed User
Is it possible to retain the sender of a previously clicked view by assigning it to a global variable? the documentation for sender states: "Returns the object that raised the event. Only valid while inside the event sub." is this true because it is being assigned to a local variable or is it a characteristic of its special nature? I apologize for the noob question but I couldn't find anything in previous posts and I have been getting inconsistent results in my code. Basically what I am trying to do is swap the information in one view with the previously selected view (no pun intended)
 

Cableguy

Expert
Licensed User
Longtime User
In globals...

Dim myoldbutton as button

In the destination event...

Dim mynewbutton as button = sender
If myoldbutton <> mynewbutton then myoldbutton =mynewbutton


P.S. this is pseudo-code just to get you off in the right direction
 
Upvote 0
Top