B4J Question [ABMaterial] how to verify if a component exists inside a page/container?

rbirago

Active Member
Licensed User
Longtime User
In my trials I have generated a dynamic page (some components exist only under some conditions). In another part of the code (same page of course) I have to operate with the components, but I have to be shure the component exists, otherwise the system gives me the error "No component found with id xxxx".
I have searched for an instruction like page.component("xxx").exists but I have not founded something similar. Which is the method to verify the existence of a component inside a page?
thank you
Roberto
 

John Naylor

Active Member
Licensed User
Longtime User
In my trials I have generated a dynamic page (some components exist only under some conditions). In another part of the code (same page of course) I have to operate with the components, but I have to be shure the component exists, otherwise the system gives me the error "No component found with id xxxx".
I have searched for an instruction like page.component("xxx").exists but I have not founded something similar. Which is the method to verify the existence of a component inside a page?
thank you
Roberto


B4X:
    Dim test As Object
    test = page.Component("ComponentID")

Then check if test is pointing somewhere or NULL.
 
Upvote 0
Top