Problem Adding panel in tabpages to multiple Forms

Discussion in 'Questions (Windows Mobile)' started by mozaharul, Apr 23, 2008.

  1. mozaharul

    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,
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    You should create a different object for each TabControl used.
    Instead of using tbc again you should choose Tools - Add Object - TabControl and create a new tab control.
     
  3. mozaharul

    mozaharul Active Member Licensed User

    Thank you.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice