Dim mp As B4XMainPage = B4XPages.Get("MainPage") should be Dim mp As B4XMainPage = B4XPages.GetPage("MainPage")