Focus can not leave the spread

Posted by: bittyboy-fp on 8 September 2017, 2:42 pm EST

  • Posted 8 September 2017, 2:42 pm EST




    i use vs2010 and spread for windows forms 5 (.net 3.5) for developing.

    but recently,i have some focus problems.

    for example

    i put a spread and a textbox in the windows form.

    then i write some code like this:


    Private Sub FpSpread1_CellClick(ByVal sender As System.Object, ByVal e As FarPoint.Win.Spread.CellClickEventArgs) Handles FpSpread1.CellClick <span style="mso-spacerun:yes;">       </span>

    <span style="mso-spacerun:yes;"></span><span class="Apple-tab-span" style="white-space:pre;"> </span>TextBox1.Focus() <span style="mso-spacerun:yes;">   </span>

    <span style="mso-spacerun:yes;"> </span>End Sub 


    when i run the program above

    i found that

    the focus can not be set to the textbox

    it still set to the spread 

    i do not know why. 

    can anyone tell me?


    thanks all. 


  • Replied 8 September 2017, 2:42 pm EST



    i have tried your method

    but it failed

    i think you misunderstood  my needs


    when the spread‘s cellclick event occurs

    i want to set the focus to the textbox


    i use the code when i first post the help message

    but it did not work


    thanks anyway 


  • Replied 8 September 2017, 2:42 pm EST


    I would suggest you to cancel the default functionality of the CellClick event before setting the focus to the textbox and this would solve your problem. The code for doing the same is:

         void fpSpread1_CellClick(object sender, FarPoint.Win.Spread.CellClickEventArgs e)
                e.Cancel = true;
                fpSpread1.FocusRenderer = null;


    Manpreet Kaur.

  • Replied 8 September 2017, 2:42 pm EST


    You may set   FpSpread1.FocusRenderer = Nothing when you do not want the spread to be looked like focused.




  • Replied 8 September 2017, 2:42 pm EST



    i will try it tomorrow and tell you the result

    because i don't have the develop environment at home



  • Replied 8 September 2017, 2:42 pm EST

    thanks very much

    it works



    i still don't know why 


  • Replied 8 September 2017, 2:42 pm EST


    CellClick event sets the focus to the cell from where it has been called, when the CellClick event is fired then we need to cancel it in order to cancel the default functionality of that particular event and perform our own functionality. If we will not set the Cancel property of the CellClick event to false then it will it will first set the focus to the spread cell, then to TextBox and since the event is not completed yet, hence the focus will be again on spread i.e. why you aren't able to see the blinking cursor in the textbox.

    Thereon, setting the FocusRenderer to null just prevent the spread cell form getting highlighted and every-time the focus would be on TextBox.



  • Replied 8 September 2017, 2:42 pm EST

    <SPAN class=Apple-style-span style="WORD-SPACING:0px;FONT:medium Simsun;TEXT-TRANSFORM:none;TEXT-INDENT:0px;WHITE-SPACE:normal;LETTER-SPACING:normal;BORDER-COLLAPSE:separate;orphans:2;widows:2;webkit-border-horizontal-spacing:0px;webkit-border-vertical-spacing:0px;webkit-text-decorations-in-effect:none;webkit-text-size-adjust:auto;webkit-text-stroke-width:0px;"><SPAN class=Apple-style-span style="FONT-SIZE:13px;FONT-FAMILY:Arial, Helvetica, sans-serif;">


    thank you

    <img src="/emoticons/emotion-21.gif" alt="Yes" />

Need extra support?

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

Learn More

Forum Channels