referencing a dynamically created iOSTable

I am creating an iOSTable dynamically with:

Dim resolutionTable As New iOSTable mainView.AddControl(resolutionTable)

When I try to reference that table elsewhere in the project I get an error that it does not exist. I presume this is because the table does not exist in the project.

[quote=224939:@JP Kelly]I am creating an iOSTable dynamically with:

Dim resolutionTable As New iOSTable mainView.AddControl(resolutionTable)

When I try to reference that table elsewhere in the project I get an error that it does not exist. I presume this is because the table does not exist in the project.[/quote]

You must keep a reference to the table you just dimmed. You can do that by adding a resolutionTable as iOSTable property to app or to a module and use it instead :

resolutionTable = New iOSTable mainView.AddControl(resolutionTable)

I have tried creating a resolutionTable as iOSTable property but I get a Nil object error when I try to add the table to the view with

mainView.AddControl(resolutionTable)

1 - Where did you add the property ? App ? Module ? If app, you must reference it as App.resolutionTable. Make sure to make it Public in App and Global in a module.

2 - Why did you not use the first line of the code I posted ?

Thank you.
I did not replace my code with your code and so it did not work.
Now it works.
I was confused about what happens when you use Dim I guess.
It deems Dim is basically the same as adding a property to the project?

[quote=224952:@JP Kelly]Thank you.
I did not replace my code with your code and so it did not work.
Now it works.
I was confused about what happens when you use Dim I guess.
It deems Dim is basically the same as adding a property to the project?[/quote]

You should read page 81 of the User Guide-Fundamentals.pdf document in the Documentation folder of your Xojo copy, It is important you understand the notion of scope.

I think I get the idea of scope but I guess not in relation to instantiating objects. I think My problem was I was creating the object twice (With Dim and by adding a property to the project).

Anyway thank you and I will RTM.

[quote=224956:@JP Kelly]I think I get the idea of scope but I guess not in relation to instantiating objects. I think My problem was I was creating the object twice (With Dim and by adding a property to the project).

Anyway thank you and I will RTM.[/quote]

When a property exists you do not need to dim it again. Just to initialize it.

Object properties and data types work exactly alike as scope is concerned.