Android Question Send B4xPage to a sub

mrumball

Member
Licensed User
Longtime User
Hi,

I have a common sub routine that operates on 2 different pages, how do I send the page information to the sub?

I am currently using a string to hold the sender page then use SELECT to work out which page to operate on, this works but is messy, I am sure that there is a cleaner way. Can anyone help?

B4X:
Public Sub TestSub(senderpage As String)
    
    Select senderpage
                
                
        Case "STOCK_LOCATE"
                
            B4XPages.MainPage.Page_STOCK_LOCATE.LblPartDescription.Text = "Part number not found"
        Case "STOCK_OUT"
                    
            B4XPages.MainPage.Page_STOCK_OUT.LblPartDescription.Text = "Part number not found"
            
    End Select
    
End Sub
 

mrumball

Member
Licensed User
Longtime User
Thanks for your quick reply Erel, I may have not explained what I am looking to achieve,

I want to send 'B4XPages.MainPage.Page_STOCK_LOCATE' or 'B4XPages.MainPage.Page_STOCK_OUT' to the sub

B4X:
Public Sub TestSub(senderpage As Object)
    

                
            senderpage.LblPartDescription.Text = "Part number not found"
    
                    
    
End Sub

The above does not work
Thanks
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…