simple label question

MarkoMylo

Member
Licensed User
Longtime User
in designer i created LABEL form with label1 name,
how to add text to label from program or how to change label text when pressing button.
tried everything but does not work

in globals
Dim Label1 As Label

in activity create
Label1.Initialize("")
Label1.TextSize= 30
Label1.text= "b4a"

text "b4a" doesnt appear
 
Could it be that you have forgotten to add the label to the activity?

Code: Copy
Activity.Addview(Label1, left, top, width, height)

Replace the position words with values eg, 0,0,100dip, 10dip

Okay?
Regards

Mark
 
Upvote 0
Sorry I missed the first few words.

in designer i created LABEL form with label1 name,

and then

Label1.Initialize("")

If the layout is created in designer then you don't need this line!

Regards
Mark
 
Upvote 0
When i test this and i do not Initialize the Label the Output seems correct.

Code: Copy
Activity.LoadLayout("Label")
Label1.TextSize= 30
Label1.text= "b4a"
 
Upvote 0
Back
Top