GrapeCity Forums

The GrapeCity Message Boards
Welcome to GrapeCity Forums Sign in | Join | Help
in Search

SheetDataModelEventHandler not fired when using Spread.Open

Last post 02-11-2010, 3:08 PM by SureshD. 7 replies.
Sort Posts: Previous Next
  •  02-08-2010, 2:30 PM 87154

    SheetDataModelEventHandler not fired when using Spread.Open

    Hello,

    I have a SheetDataModelEventHandler event that is fired everytime the value in on the sheet (DataModel) changes. It all works fine but if I use fpSpread1.Open("SomePathToTheSpreadFile"), then the event does not fire?

    Here is the sample code

    ========================

     namespace WindowsFormsApplication1

    {

        public partial class Form3 : Form

        {

            FarPoint.Win.Spread.Model.BaseSheetDataModel model;       


            public Form3()

            {

                InitializeComponent();  

                model = (FarPoint.Win.Spread.Model.BaseSheetDataModel)fpSpread1.ActiveSheet.Models.Data;           

                model.Changed += new FarPoint.Win.Spread.Model.SheetDataModelEventHandler(modelDataModelChanged);

            }


            private void modelDataModelChanged(object sender, FarPoint.Win.Spread.Model.SheetDataModelEventArgs e)

            {

                // Code to execute whenver a value changes on the sheet

            }


            private void Form3_Load(object sender, EventArgs e)

            {        

                // If I comment out the below line than the program runs fine and fires the Changed Event

                fpSpread1.Open(@"C:\TestProjects\WindowsFormsApplication1\WindowsFormsApplication1\form3Spread.xml");


                fpSpread1.Sheets[0].DataSource = myDataTable; 

                fpSpread1.Sheets[0].RecalculateAll();            

            } 

        }

    }

    ======================== 

      

  •  02-09-2010, 2:06 AM 87166 in reply to 87154

    Re: SheetDataModelEventHandler not fired when using Spread.Open

    Hello,

    I am able to replicate the issue at my end.I am further working on this to get to know if this is the way it works.I will update you soon.

    Thanks,


    Deepak Sharma
    GrapeCity FarPoint
  •  02-09-2010, 10:27 AM 87183 in reply to 87166

    Re: SheetDataModelEventHandler not fired when using Spread.Open

    Thank you Deepak. Please let me know. We have a quite a few applications that uses Farpoint esp with this feature. We would want this feature to work for the criticality of the application. 
  •  02-09-2010, 11:45 PM 87195 in reply to 87183

    Re: SheetDataModelEventHandler not fired when using Spread.Open

    Hello,

    After some research it is found to be the default behavior of Spread, no event fires using Open method.You need to call your code from where the Open method is being called in your code.

     

    Thanks,

     


    Deepak Sharma
    GrapeCity FarPoint
  •  02-10-2010, 9:39 AM 87208 in reply to 87195

    Re: SheetDataModelEventHandler not fired when using Spread.Open

    Hello Deepak,

     I don't quite follow your suggestion? What do you mean by "You need to call your code from where the Open method is being called in your code." ?

    Can you please please provide some sample code for clarity. I am sure there are quite a number of users who will run into this issue.

  •  02-11-2010, 12:02 AM 87217 in reply to 87208

    Re: SheetDataModelEventHandler not fired when using Spread.Open

    Hello,

    You may call/write your code where the Open method is used.For example if I want to set the back color for alternate rows in Sheet1 after importing an excel file, I will follow the following approach,

        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            FpSpread1.Open("D:\aa2.xls")
            Rowbackcolor()                              ' you can write your code to be called here
        End Sub
        Private Sub Rowbackcolor()
            FpSpread1.ActiveSheet.AlternatingRows(0).BackColor = Color.Blue
        End Sub


    Thanks,

     

     



    Deepak Sharma
    GrapeCity FarPoint
  •  02-11-2010, 9:20 AM 87228 in reply to 87217

    Re: SheetDataModelEventHandler not fired when using Spread.Open

    Hello Deepak,

    I have a Timer event that updates prices on one column. I have another column that has formula so the values of the second column changes too. Since happens at periodic interval and I have no control over when the values change in these cells, I have to fired a the event and call the SheetDataModelEventHandler. 

    Are you saying there is no way around where I can this to work when using Spread.Open method? If yes, this is a serious limitation in your product. Would you guys have any fix for it? 

     Thanks,

    Amit Vasant 

     

  •  02-11-2010, 3:08 PM 87238 in reply to 87228

    Re: SheetDataModelEventHandler not fired when using Spread.Open

    Amit,

    As for the Open method, there is no associated event which gets fires on calling Open method and for ("I have no control over when the values change in these cells") there is a Change event which will fire in case you modify the cell contents.


    Suresh Singh Dasila
    GrapeCity FarPoint
View as RSS news feed in XML
     FarPoint Forums Home