Find/Replace and Change Event

Posted by: jbrazill on 8 September 2017, 3:00 pm EST

  • Posted 8 September 2017, 3:00 pm EST

    Hello,


    I have a situation I need guidance on.


    I have created a Find/Replace dialog that has a public variable fps as Farpoint.Win.Spread.FpSpread.


    I show the dialog setting fps variable to an object spreadsheet in what ever form calls the dialog. The reason I do this is I want to make this dialog generic, not tied to a specific spread control on a specific form, so if I have multiple forms with different spread controls, I want to be able to search and replace using the dialog. Works great, except...


    I have specific functionality in the Change event of the object spread controls.


    I am expecting this event to fire when my dialog replaces text but it does not fire. I am supposing the reason is that by setting the object spread to the find/replace dialog public variable, it is somehow disconnected from the object spread control events. It is clear that when I get a hit on a search string and replace the .text property of the cell, it does reflect in the object spreadsheet cell but I need the event to fire.


    What would a good technique be to get this accomplished?


     Thanks for your help


    JP

  • Replied 8 September 2017, 3:00 pm EST

    Hello,

    The Change event is fired only  when the user manually edits the cell in the spread sheet. As you said you are changing the cell value using the Text property of the cell,  the Change event would not be fired in this case. You should use the CellChanged event in place of the Change event as it is fired as soon as any change is made to the cell either manually or using the code. I have attached a sample similar to the one you are creating to depict the same. Execute the sample, it shows a form with Spread and a button, click on the button to display other form to change the text in the first cell of the active sheet, as soon as you click on the button in the second form to change the text of the first cell in Spread contained on the first form it changes the text and fires the CellChanged event.

    Hope it will help you. Please let me know if you have any queries further.

    Thanks,

    Manpreet Kaur


    2012/09/ChangeEvent.zip
  • Replied 8 September 2017, 3:00 pm EST

    Hi Manpreet,

    Thank you for your reply.... I should have qualified that I am using version 5 in a VB 2008 environment. Although I can not execute, I have managed to look at your code and produced the vb equivalent. It works.

    Thank you for your most excellent support...

    JP Brazill

Need extra support?

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

Learn More

Forum Channels