Problem Adding panel in tabpages to multiple Forms

mozaharul

Active Member
Licensed User
Hi all,
I’ve added tabpages to 1st Form and panels (to house controls like- combo box, text box etc.) to each of the tabpages Like:

'Adding Tab pages to the Form2
tbc.New1("form2",2,10,230,250)
tbc.AddTabPage("Geo Info.")
tbc.AddTabPage("House Hold Info.")
tbc.AddTabPage("Water & Sanitation")
tbc.AddControl("panel1",0,0,0)'panel for Tabpage Geo info.
tbc.AddControl("panel2",1,0,0)'panel for Tabpage House Hold Info.
tbc.AddControl("panel3",2,0,0)'panel for Tabpage Water & Sanitation

Now I want to add tabpages to another From and panels as well to each of the tabpages like above.

'Adding Tab pages to the Form3
tbc.New1("form3",2,10,230,250)
tbc.AddTabPage ("1st page")
tbc.AddTabPage ("2nd page")
tbc.AddTabPage ("3rd page")

up to this point no-problem. But problem starts when I tried to add panel to the 1st tabpage, like:

tbc.New1("form3",2,10,230,250)
tbc.AddTabPage ("1st page")
tbc.AddTabPage ("2nd page")
tbc.AddTabPage ("3rd page")
tbc.AddControl("panel4",0,0,0)

I guess, the syntax is not correct as it conflict with the 1st tabpage of the 1st Form. And the error message is:

Error occurred on Sub app_start.
Line number : xx
Tbc.Addcontrol(“panel4”,0.0,0)
Error description:
Unable to cast object of type ‘System.Int32’ to type ‘System.windows.Form.Control’.
Continue?

Need help.

Regards,
 
Top