B4J Question string Form Name

BeneBarros

Active Member
Licensed User
I have in SqlServer a table that contains the name and description of the forms that I use in a system.
Is there any way to run the form with the name in a string variable ?.
example:
Currently do so.
B4X:
Dim lb as label = lstProg.Get (lstProg.SelectedIndex)
formName = lb.tag
Select Case formName
    Case "UserLogin"
        UserLogin.show (..., ..., ...)
    ...
    ...
end select
It has to do something like this?
avoiding the Select case?
B4X:
Dim lb as label = lstProg.Get (lstProg.SelectedIndex)
formName = lb.tag
formName.show (... ....)
thank you
 
Last edited:

BeneBarros

Active Member
Licensed User
Please use [code]code here...[/code] tags when posting code.

You can create a Map that maps between the forms names and the forms:
B4X:
Dim forms As Map = CreateMap("Form1": Form1, "Form2": Form2, ...)
...
Dim frm As Form = forms.Get(formName)
frm.Show
This me returning an error in frm.Show
 

Attachments

Top