RowCount Changed event

Posted by: veera6681 on 8 September 2017, 2:20 pm EST

  • Posted 8 September 2017, 2:20 pm EST

    i need to raise the event when im adding or delete spread sheet rows..

    how to achieve this...

     

    thanks in advance..

  • Replied 8 September 2017, 2:20 pm EST

    Hello,

     I am not aware of any events which get fired when this happens. You should be able
    to call
    a function to run code after adding or removing rows programatically. Here is the
    Sample code for the same:

            int i = 0;
            int j = 0;
            public Form1()
            {
                InitializeComponent();
                fpSpread1.ActiveSheet.Rows.Count = 5;
                fpSpread1.ActiveSheet.Columns.Count = 3;
            }

            private void AddRows_Click(object sender, EventArgs e)
            {
                fpSpread1.ActiveSheet.Rows.Add(fpSpread1.ActiveSheet.Rows.Count, 1);
                EventAddRows(fpSpread1);
            }
            private void EventAddRows(FarPoint.Win.Spread.FpSpread fp)
            {
                fpSpread1.Sheets[0].Cells[0, 0].Value = 1 + i;
                i++;
            }
            private void RemoveRows_Click(object sender, EventArgs e)
            {
                if (fpSpread1.ActiveSheet.Rows.Count > 0)
                {
                    fpSpread1.ActiveSheet.Rows.Remove(0, 1);
                    EventDeleteRows(fpSpread1);
                }
            }
            private void EventDeleteRows(FarPoint.Win.Spread.FpSpread fpSpread1)
            {
                if (fpSpread1.ActiveSheet.Rows.Count > 0)
                {
                    fpSpread1.Sheets[0].Cells[0, 1].Value = 1 - j;
                    j++;
                }
            }

    Hope this will help you. Thanks.

Need extra support?

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

Learn More

Forum Channels