.ClipboardCut() resulting blank

Posted by: maverick123 on 8 September 2017, 2:39 pm EST

  • Posted 8 September 2017, 2:39 pm EST

    <font size="3" face="Times New Roman">

    </font>

    <font face="Verdana">Hi Farpoint,<o:p></o:p></font>

    <font size="3" face="Times New Roman">

    </font>

    <font face="Verdana">I am trying to map Farpoint Spread Cut, Copy and Paste by my
    custom code. But doing so I am facing an issue that when the user perform cut
    operation thru Keyboard (Ctrl + X). The clip board always results blank.<o:p></o:p></font>

    <font size="3" face="Times New Roman">

    </font>

    <font face="Verdana">Farpoint Spread AutoClipboard = True<o:p></o:p></font>

    <font size="3" face="Times New Roman">

    </font>

    <font face="Verdana">My Code is as follows:<o:p></o:p></font>

    <font size="3" face="Times New Roman">

    </font>

    <span style="color:blue;font-family:Consolas;font-size:9.5pt;">Private</span><span style="font-family:Consolas;font-size:9.5pt;"> <span style="color:blue;">Sub</span>
    FpSpread1_KeyDown(<span style="color:blue;">ByVal</span> sender <span style="color:blue;">As</span> <span style="color:blue;">Object</span>, <span style="color:blue;">ByVal</span> e <span style="color:blue;">As</span>
    System.Windows.Forms.<span>KeyEventArgs</span>) <span style="color:blue;">Handles</span> FpSpread1.KeyDown<o:p></o:p></span>

    <font size="3" face="Times New Roman">

    </font>

    <span style="font-family:Consolas;font-size:9.5pt;"><span style="mso-spacerun:yes;">   
    </span>mCutOperation = <span style="color:blue;">False</span><o:p></o:p></span>

    <font size="3" face="Times New Roman">

    </font>

    <span style="font-family:Consolas;font-size:9.5pt;"><o:p> </o:p></span>

    <font size="3" face="Times New Roman">

    </font>

    <span style="font-family:Consolas;font-size:9.5pt;"><span style="mso-spacerun:yes;">    </span><span style="color:blue;">If</span> <span>Control</span>.ModifierKeys
    = <span>Keys</span>.Control <span style="color:blue;">Then</span><o:p></o:p></span>

    <font size="3" face="Times New Roman">

    </font>

    <span style="font-family:Consolas;font-size:9.5pt;"><span style="mso-spacerun:yes;">      </span><span style="color:blue;">If</span> e.KeyCode = <span>Keys</span>.X
    <span style="color:blue;">Then</span><o:p></o:p></span>

    <font size="3" face="Times New Roman">

    </font>

    <span style="font-family:Consolas;font-size:9.5pt;"><span style="mso-spacerun:yes;">       
    </span>mCutOperation = <span style="color:blue;">True</span><o:p></o:p></span>

    <font size="3" face="Times New Roman">

    </font>

    <span style="font-family:Consolas;font-size:9.5pt;"><span style="mso-spacerun:yes;">       
    </span>e.Handled = <span style="color:blue;">True</span><o:p></o:p></span>

    <font size="3" face="Times New Roman">

    </font>

    <span style="font-family:Consolas;font-size:9.5pt;"><span style="mso-spacerun:yes;">      </span><span style="color:blue;">End</span> <span style="color:blue;">If</span><o:p></o:p></span>

    <font size="3" face="Times New Roman">

    </font>

    <span style="font-family:Consolas;font-size:9.5pt;"><span style="mso-spacerun:yes;">    </span><span style="color:blue;">End</span> <span style="color:blue;">If</span><o:p></o:p></span>

    <font size="3" face="Times New Roman">

    </font>

    <span style="font-family:Consolas;font-size:9.5pt;"><o:p> </o:p></span>

    <font size="3" face="Times New Roman">

    </font>

    <span style="font-family:Consolas;font-size:9.5pt;"><span style="mso-spacerun:yes;">  </span><span style="color:blue;">End</span> <span style="color:blue;">Sub</span><o:p></o:p></span>

    <font size="3" face="Times New Roman">

    </font>

    <span style="font-family:Consolas;font-size:9.5pt;"><o:p> </o:p></span>

    <font size="3" face="Times New Roman">

    </font>

    <span style="font-family:Consolas;font-size:9.5pt;"><span style="mso-spacerun:yes;">  </span><span style="color:blue;">Private</span> <span style="color:blue;">Sub</span>
    FpSpread1_KeyUp(<span style="color:blue;">ByVal</span> sender <span style="color:blue;">As</span> <span style="color:blue;">Object</span>, <span style="color:blue;">ByVal</span> e <span style="color:blue;">As</span>
    System.Windows.Forms.<span>KeyEventArgs</span>) <span style="color:blue;">Handles</span> FpSpread1.KeyUp<o:p></o:p></span>

    <font size="3" face="Times New Roman">

    </font>

    <span style="font-family:Consolas;font-size:9.5pt;"><o:p> </o:p></span>

    <font size="3" face="Times New Roman">

    </font>

    <span style="font-family:Consolas;font-size:9.5pt;"><span style="mso-spacerun:yes;">    </span><span style="color:blue;">If</span> mCutOperation <span style="color:blue;">Then</span><o:p></o:p></span>

    <font size="3" face="Times New Roman">

    </font>

    <span style="font-family:Consolas;font-size:9.5pt;"><span style="mso-spacerun:yes;">     
    </span>FpSpread1.ActiveSheet.ClipboardCut()<o:p></o:p></span>

    <font size="3" face="Times New Roman">

    </font>

    <span style="font-family:Consolas;font-size:9.5pt;"><span style="mso-spacerun:yes;">    </span><span style="color:blue;">End</span> <span style="color:blue;">If</span><o:p></o:p></span>

    <font size="3" face="Times New Roman">

    </font>

    <span style="font-family:Consolas;font-size:9.5pt;"><o:p> </o:p></span>

    <font size="3" face="Times New Roman">

    </font>

    <span style="font-family:Consolas;font-size:9.5pt;"><span style="mso-spacerun:yes;">  </span><span style="color:blue;">End</span> <span style="color:blue;">Sub</span><o:p></o:p></span>

    <font size="3" face="Times New Roman">

    </font>

    <span style="font-family:Consolas;font-size:9.5pt;"><o:p> </o:p></span>

    <font size="3" face="Times New Roman">

    </font>

    <font face="Verdana">Please guide me in this regard.<o:p></o:p></font>

    <font size="3" face="Times New Roman">

    </font>

    <font face="Verdana">Thanks,<o:p></o:p></font>

    <font size="3" face="Times New Roman">

    </font>

    <font face="Verdana">Maverick.<o:p></o:p></font>

    <font size="3" face="Times New Roman">

    </font>
  • Replied 8 September 2017, 2:39 pm EST

    If you put a break point in your KeyUp handler is a selection made? <FONT face="Courier New">fpSpread1.ActiveSheet.GetSelections() should return a cellrange. If there is no CellRange selected then there will be no data cut to the clipboard</FONT>
Need extra support?

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

Learn More

Forum Channels