Problem when trying to add a spread control dynamically on the fly

Posted by: j2associates on 8 September 2017, 12:56 pm EST

  • Posted 8 September 2017, 12:56 pm EST

    Hello all,

    I am trying to add tab pages with embedded spread controls on the fly with code like the following: 

    <SPAN class=kwd>With Me</SPAN>.TabControl1
    <SPAN class=cmt>' Create new tab page with spread control on it.
    .TabPages.Add(<SPAN class=kwd>New</SPAN> TabPage(<SPAN class=st>"MyText"</SPAN>))

    <SPAN class=kwd>With</SPAN> .TabPages(index).Controls
    .Add(<SPAN class=kwd>New</SPAN> FpSpread())

    <SPAN class=cmt>' Setup embedded spread control.
    <SPAN class=kwd>With DirectCast</SPAN>(.Item(0), FpSpread)
    .Name = <SPAN class=st>"FpSpread"</SPAN> & index.ToString
    .DataSource = table
    <SPAN class=kwd>End With
    End With
    End</SPAN> With
    The problem is that the DataSource property is still Nothing after setting it.
    Thanks in advance for any ideas and/or suggestions!<FONT face="Times New Roman">
  • Replied 8 September 2017, 12:56 pm EST

    I know the fpSpread is being created correctly because the Name property changes based upon the above code. Sorry, I forgot to note that in the first posting.
  • Replied 8 September 2017, 12:56 pm EST

    Hello all,

    For the benefit of others, I needed to add at least one SheetView to the FpSpread. Once I inserted the following line before I set the DataSource property, it worked perfectly. 

    .Sheets.Add(<SPAN class=kwd>New</SPAN> FarPoint.Win.Spread.SheetView)
    .DataSource = table
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels