Ok, so you have a class that retrieves and organizes Data from a DataBase, and you want to pass a completely Formed Layout to a panel In the main activity, correct?
you need to understand that a class usually does not call activity subs, its main purpose is to return values or execute funtions.
for instance, if you want to show a panel created by your class you shoul do something like this:
class code:
Sub Class_Globals
Dim DataPanel As Panel
Dim DataField As Label
End sub
Sub Initialize (Target as Panel) 'Target is the calling activity
DataPanel.Initialize("")
DataField.Initialize("")
DataPanel.AddView(DataFIeld, (.......))' here we add the DataField to the DataPanel
Target.AddView(DataPanel, (.......))' here you place your DataPanel in the Calling Activity, setting Left,Top,etc
(....)
'the rest of the data manipulation can be done here or dispatched for other Class Subs
End Sub
Then in Main....
Define a Class object from your Class, usualy in Globals, like
Dim MyDataClass as DataClass 'Here DataClass is the name of your Class and MyDataClass is and object of it
then to make the DataPanel Appear in the activity,
MyDataClass.Initialize(Activity)
That's it
Remember, this is just for exemplification purposes, my code is incomplete in some lines and may even be misspelled or erroneous.
Play with it, adapt it, read some Classes tutorials...