Accecing views from designer layout

sanduro

Member
Licensed User
Longtime User
Hi,

I have created a simple layout, its loaded with

Activity.LoadLayout ("Main")

code. There is a button on layout called Button1. How can I access this button in runtime in order to modify his properties ?

San
 

nrasool

Member
Licensed User
Longtime User
Hi,
How can I access this button in runtime in order to modify his properties ?
San

You should have a sub called Button1_Click

If you don't have that, then go back to the designer, click again on generate members, click on the + sign next to Button1, and you will see Button1_Click, make sure this is ticked as well, and again generate member

Now in your code, you will see that sub, this will be how it is accessed


Hope this helps

Kind Regards
 
Upvote 0

sanduro

Member
Licensed User
Longtime User
Maybe I wasn't specific with question, I want to access Button class functions, like set another text, color, etc ...

San
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
You need to Dim Button1 As Button in the Globals routine, this can also be done with 'Generate Members' from the Designer.
Then after having loaded the layout file you can set every propety with:
Button1.Text = "Test"
Button1.Color = Colors.Red

etc.

Best regards.
 
Upvote 0
Top