How to programatically raise the EditChange event?

Posted by: ghr on 8 September 2017, 1:36 pm EST

  • Posted 8 September 2017, 1:36 pm EST

    Hi, I recently upgraded the Spread control from COM to .NET version. In the COM version I could programatically call the EditMode event using something like this:

    <FONT size=1>

    vaSpread1_EditMode(2, 9, vaSpread1(2).MaxRows, 0, </FONT><FONT color=#0000ff size=1><FONT color=#0000ff size=1>True</FONT></FONT><FONT size=1>) </FONT><FONT color=#008000 size=1><FONT color=#008000 size=1>'Simulate event raised by user</FONT></FONT>


    As I'm migrating to a .NET enviroment, I want to programatically raise this event, but I'm somehow confused as I'm not too familiarized yet with this version or .NET. How to proceed?


    Thanks in advance.


    <FONT color=#008000 size=1><FONT color=#008000 size=1> 

    </FONT></FONT>
  • Replied 8 September 2017, 1:36 pm EST

    Hello,


    All you need to do is to call the function that implements the event and pass the correct parameters.

    <FONT size=2>

    </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>Private</FONT></FONT><FONT size=2> </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>Sub</FONT></FONT><FONT size=2> Button1_Click(</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>ByVal</FONT></FONT><FONT size=2> sender </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>As</FONT></FONT><FONT size=2> </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>Object</FONT></FONT><FONT size=2>, </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>ByVal</FONT></FONT><FONT size=2> e </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>As</FONT></FONT><FONT size=2> System.EventArgs) </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>Handles</FONT></FONT><FONT size=2> Button1.Click


    </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>Dim</FONT></FONT><FONT size=2> eSend </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>As</FONT></FONT><FONT size=2> </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>New</FONT></FONT><FONT size=2> System.EventArgs


    FpSpread1_EditModeOn(FpSpread1, e)


    </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>End</FONT></FONT><FONT size=2> </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>Sub

    </FONT></FONT><FONT size=2>

    </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>Private</FONT></FONT><FONT size=2> </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>Sub</FONT></FONT><FONT size=2> FpSpread1_EditModeOn(</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>ByVal</FONT></FONT><FONT size=2> sender </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>As</FONT></FONT><FONT size=2> </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>Object</FONT></FONT><FONT size=2>, </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>ByVal</FONT></FONT><FONT size=2> e </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>As</FONT></FONT><FONT size=2> System.EventArgs) </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>Handles</FONT></FONT><FONT size=2> FpSpread1.EditModeOn


    </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>End</FONT></FONT><FONT size=2> </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>Sub

    </FONT></FONT>
  • Replied 8 September 2017, 1:36 pm EST

    Thanks for your answer. Based on your input, as I understood, I'm trying the following:

    <FONT size=1>

    </FONT><FONT color=#0000ff size=1><FONT color=#0000ff size=1></FONT></FONT> 


    <FONT color=#0000ff size=1><FONT color=#0000ff size=1>Dim</FONT></FONT><FONT size=1> e </FONT><FONT color=#0000ff size=1><FONT color=#0000ff size=1>As</FONT></FONT><FONT size=1> </FONT><FONT color=#0000ff size=1><FONT color=#0000ff size=1>New</FONT></FONT><FONT size=1> FarPoint.Win.Spread.EditorNotifyEventArgs( ??,  FpSpread0,  FpSpread0.Sheets(0).RowCount,  8) ' <- Confused about constructor</FONT>


    <FONT size=1>FpSpread0_EditChange(FpSpread0, e)</FONT>


     


    I'm struggling with the argument constructor, acording to documentation first constructor parameter is a View, the second one an editingControl, and the last ones the row and column.


    What is the correct object to pass on first parameter?


    In the second one I'm passing the spread control FpSpread0 itself, it is correct?


    Thanks in advance. 


     

  • Replied 8 September 2017, 1:36 pm EST

    One of the correct ways would be the following...

    Dim eh As New FarPoint.Win.Spread.EditorNotifyEventArgs(FpSpread1.GetRootWorkbook, FpSpread1.EditingControl, 1, 1)
    FpSpread1_EditChange(FpSpread1, eh)

Need extra support?

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

Learn More

Forum Channels