Error when moving treeview to a tabcontrol

Discussion in 'Questions (Windows Mobile)' started by Peter, May 14, 2007.

  1. Peter

    Peter Member Licensed User

    I'm trying to move a treeview control to a tab page.
    Basic4PPC responds with the error message : Unable to cast object of type 'Dbasic.Other.SwrapObject' to type 'System.Windows.Forms.Control'

    Am I doing something wrong?

    Code:
    Sub App_Start

       Form1.Show
       
    sip(true)
       AddLabel (form1,
    "Label2"556020"Option:")
       AddTextBox (Form1,
    "TextBox1",40,20,100,25,"")
       tbc.New1 (
    "Form1", -5,0245280)
          tbc.AddTabPage(
    "Aantallen")   
            tbc.AddTabPage(
    "Hoorspel")
             tbc.AddTabPage(
    "Personen")
          tbc.AddTabPage(
    "Zoeken")
          tbc.AddTabPage(
    "Lijsten")
          tbc.AddTabPage(
    "X")
          tbc.AddTabPage(
    "Z")
          tbc.AddTabPage(
    "Configuratie")
          
    'tbc.AddControl("label1",0,20,20)
          tbc.AddControl("label2",0,20,60)      
       Con.New1
       Reader.New1
       tv.New1(
    "Form1"55, Form1.Width - 10, Form1.Height - 10)   
       
    Node.New1
       [COLOR=
    "Red"]tbc.AddControl("tv",1,20,20)[/COLOR]
       Cmd.New1(
    "",con.Value)
       Con.Open(
    "Data Source = " & AppPath & "\DNH4ppc.sl3")

    End Sub
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    The right syntax is:
    tbc.AddControl(tv.Control,1,20,20)

    This is different than regular controls because TreeView is not a built-in control.
     
  3. Peter

    Peter Member Licensed User

    Thank you, Erel, that works.

    Could i have found that in one of the help-files?

    Peter
     
Loading...