Receiving the Spread-Events in a separate (Controller Class)

Posted by: hpmx on 8 September 2017, 5:02 am EST

  • Posted 8 September 2017, 5:02 am EST



    is this possible?

    I created a class with 

    c<font face="courier new,courier">lass SpreadController </font>

    <font face="courier new,courier"> private WithEvents m_fp as Fpspread

    <font face="courier new,courier">end class </font>

     but this does not work?

    Any hint?






  • Replied 8 September 2017, 5:02 am EST


    Using the Latest build of Spread for Windows Forms, I did the same and I am able to see all the Events related to FpSpread listed in m_fp. Please have a look,

       Public Class Form1
           Private WithEvents m_fp As FarPoint.Win.Spread.FpSpread
           Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
             m_fp = New FarPoint.Win.Spread.FpSpread
             m_fp.Sheets.Count = 1
             m_fp.Sheets(0).RowCount = 10
             m_fp.Sheets(0).ColumnCount = 10
          End Sub
          Private Sub m_fp_CellClick(ByVal sender As Object, ByVal e As FarPoint.Win.Spread.CellClickEventArgs) Handles m_fp.CellClick
          End Sub
       End Class

    If this doesn't help you, please let us know your requirements in detail.




  • Replied 8 September 2017, 5:02 am EST

    Well, in my actual form (let's say myForm) I created a Spread fpMySpread with the Spread Designer.

    But I don't  want to handle the Events coming from fpMySpread in this form.

    Therefore I deceided to create a separate class:

    Class MySpreadController 

           private WithEvents m_fp as FpSpread

           Sub New(fp as FpSpread)

                 me. m_fp = fp

           end sub

    end class

    In myForm I want to create an instance of the mySpreadController by

    m_myController = new (mySpread)

    Sub MyForm_Load(....)

            m_myController = new (mySpread)

    end sub

     ...and I hoped that the events arrived in MySpreadController - but they did not arrive.

    Any hint


  • Replied 8 September 2017, 5:02 am EST


    When I created a Class named MySpreadController

    Public Class MySpreadController
        Private WithEvents m_fp As FarPoint.Win.Spread.FpSpread
        Sub New(ByVal fp As FarPoint.Win.Spread.FpSpread)
            Me.m_fp = fp
        End Sub
    End Class

    I see that the Spread's Events show up in MySpreadController with m_fp.

    Could you please send across a zipped application for us to debug.




  • Replied 8 September 2017, 5:02 am EST


    If you create a class that Inherits from the FarPoint.Win.Spread.FpSpread, then you can catch the events in that class. Take a look at the following thread for code snipet to implement this.

Need extra support?

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

Learn More

Forum Channels