1 - declare a pubblic variable in the Class_Globals of the "destination page"
2 - declare a public sub with parameter in the "destination page"
3 - declare a property in the "destination page"
In your passrandom example, in Sub Button1_Click at line 34, you have used the string "pageTwo", it should be "pagTwo" - you have an erroneous "e".
Debug is your friend!
At least, it runs ok for me with that correction.
'This event will be called once, before the page becomes visible.
Private Sub B4XPage_Created (Root1 As B4XView)
Root = Root1
Root.LoadLayout("MainPage")
pagTwo.Initialize
B4XPages.AddPageAndCreate("clsPagTwo", pagTwo)
End Sub
Sub passing_tolabel
Label2.Text = pagTwo.Val
End Sub
Sub Button1_Click
B4XPages.ShowPage("clsPagTwo")
End Sub
There was a mistake with that pages, navigation. Agree. Changed it already ... but still, it not showing a number on a label at main page after starting the generator on page 2 . Any suggestion?