DonManfred, thanks for the suggestion, I saw that thread before and I tried applying it but I kept getting errors and I couldn't figure it out.
MegatenFreak, thanks for the code. Here's what I did...
01 - I start B4J.
02 - Code Editor > File > New > UI.
03 - Project Name = Test > OK.
04 - Code Editor > Designer > Open Internal Designer.
Then I am shown 2 things...
A layout in the visual designer.
A form.
05 - I close the form.
06 - Visual Designer > Menu > Add View > TabPane.
This tabpane is called "TabPane1".
07 - I change the name to "MyTabPane".
08 - In the code editor I add your code to the button code...
Sub Button1_Click
xui.MsgboxAsync("Hello World!", "B4X")
Public MyTabPane As TabPane
Dim new_tab As TabPage
new_tab = MyTabPane.LoadLayout (new_tab_contents", "My New Tab Header")
End Sub
09 - Then I see..
Main - 23: Syntax error.
Main - 21: Variable 'MyTabPane' was not initialized. (warning #11)
Main - 22: Unused variable 'new_tab'. (warning #9)
10 - So I try initializing MyTabPane using the some code from a previous forum post (ie: "TP.Initialize") thinking that this would not only initialize MyTabPane but it might also fix the syntax error.
Sub Button1_Click
xui.MsgboxAsync("Hello World!", "B4X")
Public MyTabPane As TabPane
MyTabPane.Initialize
Dim new_tab As TabPage
new_tab = MyTabPane.LoadLayout (new_tab_contents", "My New Tab Header")
End Sub
11 - Then I see...
Main - 22: '(' expected.
Main - 24: Syntax error.
Main - 23: Unused variable 'new_tab'. (warning #9)
12 - Then I put the mouse over the problematic code and I see...
'(' expected.
Initialize (EventName As String)
13 - I don't know what the event name is, so I look at the previous forum post I mentioned before, and then I try this code...
MyTabPane.Initialize (add)
14 - Then I see...
Main - 22: Undeclared variable 'add' is used before it was assigned any value.
Main - 24: Syntax error.
Main - 23: Unused variable 'new_tab'. (warning #9)
Any thoughts?