Get Spread object from another form

Posted by: geert on 8 September 2017, 1:48 pm EST

  • Posted 8 September 2017, 1:48 pm EST

    Hello,


     I've a question about accessing the Spread object from another form. Let me explain.


     I have 2 forms in my project



    • Form 1: Main form with the Spread object with one Sheet: Testsheet

    • Form 2: Popup form which will access the spread object.

     When I access the public Spread from Form2 get the activesheet the Sheetname is Sheet1 instead of Testsheet.


     Can anyone explain what I'm doing wrong?


     Tnx!

  • Replied 8 September 2017, 1:48 pm EST

    Hello Geert,


    Please know that the (Name) property of the Sheet is different from the SheetName property.


    If you want to access the TestSheet, you may use either


    Form1.FpSpread1.Sheets(0)


    or


    Form1.TestSheet


    Regards,

  • Replied 8 September 2017, 1:48 pm EST

    I do know that, but that isn't working. When I first create 3 new sheets and than access the Spread object from another form the object doesn't recognize the sheets.


     The code keeps telling me that there only one sheet in the sheetcollection...


     Do I have to commit the changes I make to the spread object before I can access the spread object from another form?


    This is the code I use to change the sheetname


    <FONT size=2>CODE:</FONT>


    <FONT size=2>fpSpread1.ActiveSheet.SheetName = dsSettingsXml.Tables[0].Rows[0][</FONT><FONT color=#a31515 size=2><FONT color=#a31515 size=2>"URL"</FONT></FONT><FONT size=2>].ToString();</FONT>

  • Replied 8 September 2017, 1:48 pm EST

    Hello,


    Could you post a small zipped project reproducing this issue for us to debug?

Need extra support?

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

Learn More

Forum Channels