proceed with the enter key on the cell

Posted by: luis-cifuentes on 8 September 2017, 2:51 pm EST

  • Posted 8 September 2017, 2:51 pm EST

    Hi good afternoon, I want to do the following.
    proceed with the enter key on the fpspread, then at arriving at a particular column, jump to the next row.

    if you could give me a code will appreciate it.

    I forgot how to generate a new row

    Thank you.

    excuse my English, I speak Spanish

     

    Pd: <span id="result_box" class="short_text"><span class="hps">I'm using</span> <span class="hps">windows</span> <span class="hps">form</span></span>

  • Replied 8 September 2017, 2:51 pm EST


      <h4 class="dxh4">You can map the Enter key, here is a code snippet from the installed help file.  </h4><h4 class="dxh4"><font size="3" face="Times New Roman">

      </font>

      <span style="font-size:12pt;">Example<o:p></o:p></span>

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

      </font>

      <span style="font-size:10pt;">This example code sets the input map
      for operation mode Normal for both the object with focus and its ancestor. This
      example sets the Enter key to always move to the next cell. <o:p></o:p></span>

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

      </font>

      <span style="font-size:10pt;mso-bidi-font-size:11.0pt;">[C#]
      </span><span style="font-size:10pt;"><o:p></o:p></span>

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

      </font>

      <span style="font-size:10pt;">// Create an InputMap object.<o:p></o:p></span>

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

      </font>

      <span style="font-size:10pt;">FarPoint.Win.Spread.InputMap
      inputmap1;</span>

      <span style="font-size:10pt;">// Assign the InputMap object to the existing </span><span style="font-size:10pt;">map.</span>

      <span style="font-size:10pt;">inputmap1 = fpSpread1.GetInputMap(FarPoint.Win.Spread.InputMapMode.WhenAncestorOfFocused);
      <o:p></o:p></span>

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

      </font>

      <span style="font-size:10pt;">// Map the Enter key.<o:p></o:p></span>

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

      </font>

      <span style="font-size:10pt;">inputmap1.Put(new
      FarPoint.Win.Spread.Keystroke(Keys.Enter, Keys.None),
      FarPoint.Win.Spread.SpreadActions.MoveToNextRow); <o:p></o:p></span>

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

      </font>

      <span style="font-size:10pt;">// Create another InputMap object.<o:p></o:p></span>

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

      </font>

      <span style="font-size:10pt;">FarPoint.Win.Spread.InputMap
      inputmap2;<o:p></o:p></span>

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

      </font>

      <span style="font-size:10pt;">// Assign this InputMap object to
      the existing map.<o:p></o:p></span>

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

      </font>

      <span style="font-size:10pt;">inputmap2 =
      fpSpread1.GetInputMap(FarPoint.Win.Spread.InputMapMode.WhenFocused);<o:p></o:p></span>

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

      </font>

      <span style="font-size:10pt;">// Map the Enter key.<o:p></o:p></span>

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

      </font>

      <span style="font-size:10pt;">inputmap2.Put(new
      FarPoint.Win.Spread.Keystroke(Keys.Enter, Keys.None),
      FarPoint.Win.Spread.SpreadActions.MoveToNextRow); </span>

      <span style="font-size:10pt;"><o:p></o:p></span> 

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

      </font>

      <span style="font-size:10pt;mso-bidi-font-size:11.0pt;">[Visual
      Basic] </span><span style="font-size:10pt;"><o:p></o:p></span>

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

      </font>

      <span style="font-size:10pt;">' Create an InputMap object.<o:p></o:p></span>

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

      </font>

      <span style="font-size:10pt;">Dim inputmap1 As New
      FarPoint.Win.Spread.InputMap()<o:p></o:p></span>

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

      </font>

      <span style="font-size:10pt;">' Assign the InputMap object to the
      existing map.<o:p></o:p></span>

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

      </font>

      <span style="font-size:10pt;">inputmap1 =
      FpSpread1.GetInputMap(FarPoint.Win.Spread.InputMapMode.WhenAncestorOfFocused)<o:p></o:p></span>

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

      </font>

      <span style="font-size:10pt;">' Map the Enter key.<o:p></o:p></span>

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

      </font>

      <span style="font-size:10pt;">inputmap1.Put(New
      FarPoint.Win.Spread.Keystroke(Keys.Enter, Keys.None),
      FarPoint.Win.Spread.SpreadActions.MoveToNextRow) <o:p></o:p></span>

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

      </font>

      <span style="font-size:10pt;">' Create another InputMap object.<o:p></o:p></span>

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

      </font>

      <span style="font-size:10pt;">Dim inputmap2 As New FarPoint.Win.Spread.InputMap()<o:p></o:p></span>

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

      </font>

      <span style="font-size:10pt;">' Assign this InputMap object to the
      existing map.<o:p></o:p></span>

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

      </font>

      <span style="font-size:10pt;">inputmap2 =
      FpSpread1.GetInputMap(FarPoint.Win.Spread.InputMapMode.WhenFocused)<o:p></o:p></span>

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

      </font>

      <span style="font-size:10pt;">' Map the Enter key.<o:p></o:p></span>

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

      </font>

      <span style="font-size:10pt;">inputmap2.Put(New
      FarPoint.Win.Spread.Keystroke(Keys.Enter, Keys.None), FarPoint.Win.Spread.SpreadActions.MoveToNextRow)
      <o:p></o:p></span>

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

      </font>

      <o:p><font size="3" face="Calibri"> </font></o:p>

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

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

    <span id="result_box" class="short_text"><span class="hps">Thanks</span> <span class="hps">Paul</span><span>, but in that</span> <span class="hps">event</span> <span class="hps">insert</span> <span class="hps">the code</span> <span class="hps">vb.</span></span>

     

    estoy usando spread win 5 net2.0

  • Replied 8 September 2017, 2:51 pm EST

    Hello,

    To generate a new row you may capture the KeyDown event for Enter key. Check for the Active row and if it is found to be  the last row increase the RowCount for Spread.

     

     

    Thanks,

  • Replied 8 September 2017, 2:51 pm EST

    amigos a ver si me ayudan este es el codigo que tengo  lo estoy haciendo con visual basic.net  2008 utilizo fspread para windows v5.0




    Private Sub fpsread_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles detalle_venta.KeyDown
    If e.KeyCode = Keys.Enter Then
    If (detalle_venta.ActiveSheet.ActiveRowIndex + 1 = detalle_venta.ActiveSheet.RowCount) Then
    detalle_venta.ActiveSheet.AddRows(detalle_venta.ActiveSheet.ActiveRowIndex + 1, 1)
    End If
    End If
    End Sub

     

     

    Private Sub fpspread_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles detalle_venta.KeyPress

            If e.KeyChar = ChrW(Keys.Enter) Then
                e.Handled = True
                SendKeys.Send("{TAB}")

            End If
        End Sub

     

    bueno como el titulo dice quiero saltar de la columna 1 a la columna 3 con tecla enter luego dar enter y agregar nueva fila

  • Replied 8 September 2017, 2:51 pm EST

    This would do it.

    <span style="font-family:Consolas;font-size:12pt;"><span style="mso-spacerun:yes;">        </span><span style="color:blue;">private</span>
    <span style="color:blue;">void</span> fpSpread1_KeyDown(<span style="color:blue;">object</span>
    sender, <span>KeyEventArgs</span> e)</span>

    <span style="font-family:Consolas;font-size:12pt;"><span style="mso-spacerun:yes;">        </span>{</span>

    <span style="font-family:Consolas;font-size:12pt;"><span style="mso-spacerun:yes;">            </span><span style="color:blue;">if</span>
    (e.KeyCode == <span>Keys</span>.Enter)</span>

    <span style="font-family:Consolas;font-size:12pt;"><span style="mso-spacerun:yes;">                </span><span style="color:blue;">if</span>(fpSpread1.ActiveSheet.ActiveRowIndex
    + 1 == fpSpread1.ActiveSheet.RowCount)</span>

    <span style="font-family:Consolas;font-size:12pt;"><span style="mso-spacerun:yes;">                   
    </span>fpSpread1.ActiveSheet.AddRows(fpSpread1.ActiveSheet.ActiveRowIndex + 1,
    1);</span>

    <span style="font-family:Consolas;font-size:12pt;"><span style="mso-spacerun:yes;">        </span>}<o:p></o:p></span>

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

    </font>

  • Replied 8 September 2017, 2:51 pm EST

    Hello,

    The code that you have used to go to increase the row count is correct. You may set the InputMap for Spread for Enter key as shown by Paul in his earlier post.

     

    Thanks,

     

  • Replied 8 September 2017, 2:51 pm EST

    Me estan funcionando  los codigos de paul, pero al presionar enter me salta a la columna siguiente y yo quiero saltar a una columna especifica aqui les dejo una imagen de lo que quiero hacer.

    1.- lo otro necesito sumar la columna "Total" y dejar el resultado en un textbox

     2.- cada ves que presiono enter y salta a la siguiente fila me sume(+)

     

    <span id="result_box" class=""><span class="hps">I</span> <span class="hps">codes</span> <span class="hps">are working</span> <span class="hps">paul,</span> <span class="hps">but</span> <span class="hps">I</span> <span class="hps">press enter</span> <span class="hps">jumps</span> <span class="hps">to the next column</span> <span class="hps">and I want to</span> <span class="hps">jump to a</span> <span class="hps">specific</span> <span class="hps">column</span> <span class="hps">here I leave</span> <span class="hps">a picture</span> <span class="hps">of what I</span> <span class="hps">do.</span>

    <span class="hps">1 .-</span> <span class="hps">I</span> <span class="hps">need</span> <span class="hps">to add</span> <span class="hps">another</span> <span class="hps">column</span> <span class="hps">"Total</span><span class="">" and leave</span> <span class="hps">the result in a</span> <span class="hps">textbox</span>

      <span class="hps">2 .-</span> <span class="hps">Each time you press</span> <span class="hps">enter</span> <span class="hps">and jump to the</span> <span class="hps">next row</span> <span class="hps">I</span> <span class="hps">add</span> <span class="hps">(+)</span></span>

    <img src="http://s3.subirimagenes.com:81/otros/previo/thump_7347208fpsread1.jpg" title="fpspread" alt="fpspread" width="351" align="middle" height="200">

     

     
  • Replied 8 September 2017, 2:51 pm EST

    I think from what I understand of your requirements, this should move the activecell as you want it to move, as far as adding a column and and agregating totals in a textbox, I'm not clear on what exactly you want there.

    <span style="color:blue;font-family:Consolas;font-size:12pt;"></span> 

    <span style="color:blue;font-family:Consolas;font-size:12pt;">Public</span><span style="font-family:Consolas;font-size:12pt;"><font color="#000000"> </font><span style="color:blue;">Class</span><font color="#000000">
    </font><span>Form1</span></span>

    <span style="font-family:Consolas;font-size:12pt;"><span style="mso-spacerun:yes;"><font color="#000000">    </font></span><span style="color:blue;">Private</span><font color="#000000"> </font><span style="color:blue;">Sub</span><font color="#000000"> Form1_Load(sender </font><span style="color:blue;">As</span><font color="#000000">
    System.</font><span>Object</span><font color="#000000">, e </font><span style="color:blue;">As</span><font color="#000000">
    System.</font><span>EventArgs</span><font color="#000000">) </font><span style="color:blue;">Handles</span><font color="#000000">
    </font><span style="color:blue;">MyBase</span><font color="#000000">.Load</font></span>

    <span style="font-family:Consolas;font-size:12pt;"><font color="#000000"><span style="mso-spacerun:yes;">        </span>FpSpread1.ActiveSheet.RowCount = 3</font></span>

    <span style="font-family:Consolas;font-size:12pt;"><font color="#000000"><span style="mso-spacerun:yes;">        </span>FpSpread1.ActiveSheet.ColumnCount = 5</font></span>

    <span style="font-family:Consolas;font-size:12pt;"><span style="mso-spacerun:yes;"><font color="#000000">    </font></span><span style="color:blue;">End</span><font color="#000000"> </font><span style="color:blue;">Sub</span></span>

    <span style="font-family:Consolas;font-size:12pt;"><span style="color:blue;"></span></span> 

    <span style="font-family:Consolas;font-size:12pt;"><span style="mso-spacerun:yes;"><font color="#000000">    </font></span><span style="color:blue;">Private</span><font color="#000000"> </font><span style="color:blue;">Sub</span><font color="#000000"> FpSpread1_KeyDown(sender </font><span style="color:blue;">As</span><font color="#000000">
    System.</font><span>Object</span><font color="#000000">, e </font><span style="color:blue;">As</span><font color="#000000">
    System.Windows.Forms.</font><span>KeyEventArgs</span><font color="#000000">) </font><span style="color:blue;">Handles</span><font color="#000000"> FpSpread1.KeyDown</font></span>

    <span style="font-family:Consolas;font-size:12pt;"><span style="mso-spacerun:yes;"><font color="#000000">        </font></span><span style="color:blue;">Dim</span><font color="#000000">
    newRowColumn </font><span style="color:blue;">As</span><font color="#000000"> </font><span style="color:blue;">Integer</span><font color="#000000">
    = 3</font></span>

    <span style="font-family:Consolas;font-size:12pt;"><span style="mso-spacerun:yes;"><font color="#000000">        </font></span><span style="color:blue;">Dim</span><font color="#000000">
    firstColumn </font><span style="color:blue;">As</span><font color="#000000"> </font><span style="color:blue;">Integer</span><font color="#000000">
    = 0</font></span>

    <span style="font-family:Consolas;font-size:12pt;"><span style="mso-spacerun:yes;"><font color="#000000">        </font></span><span style="color:blue;">Dim</span><font color="#000000">
    skipToColumn </font><span style="color:blue;">As</span><font color="#000000"> </font><span style="color:blue;">Integer</span><font color="#000000">
    = 2</font></span>

    <span style="font-family:Consolas;font-size:12pt;"><span style="mso-spacerun:yes;"><font color="#000000">        </font></span><span style="color:blue;">Dim</span><font color="#000000">
    rowCount </font><span style="color:blue;">As</span><font color="#000000"> </font><span style="color:blue;">Integer</span><font color="#000000">
    = FpSpread1.ActiveSheet.RowCount</font></span>

    <span style="font-family:Consolas;font-size:12pt;"><span style="mso-spacerun:yes;"><font color="#000000">        </font></span><span style="color:blue;">If</span><font color="#000000">
    e.KeyCode = </font><span>Keys</span><font color="#000000">.Enter </font><span style="color:blue;">Then</span></span>

    <span style="font-family:Consolas;font-size:12pt;"><span style="mso-spacerun:yes;"><font color="#000000">            </font></span><span style="color:green;">'First
    Column Selected, skip to specific column</span></span>

    <span style="font-family:Consolas;font-size:12pt;"><span style="mso-spacerun:yes;"><font color="#000000">            </font></span><span style="color:blue;">If</span><font color="#000000">
    FpSpread1.ActiveSheet.ActiveColumnIndex = firstColumn </font><span style="color:blue;">Then</span></span>

    <span style="font-family:Consolas;font-size:12pt;"><font color="#000000"><span style="mso-spacerun:yes;">               
    </span>FpSpread1.ActiveSheet.SetActiveCell(FpSpread1.ActiveSheet.ActiveRowIndex,</font></span>

    <span style="font-family:Consolas;font-size:12pt;"><font color="#000000"><span style="mso-spacerun:yes;">                                                   
    </span>skipToColumn)</font></span>

    <span style="font-family:Consolas;font-size:12pt;"><span style="mso-spacerun:yes;"><font color="#000000">                </font></span><span style="color:green;">'New
    row Column Selected in the last row, add row and select first column in it</span></span>

    <span style="font-family:Consolas;font-size:12pt;"><span style="mso-spacerun:yes;"><font color="#000000">            </font></span><span style="color:blue;">ElseIf</span><font color="#000000">
    FpSpread1.ActiveSheet.ActiveColumnIndex = newRowColumn </font><span style="color:blue;">And</span></span>

    <span style="font-family:Consolas;font-size:12pt;"><font color="#000000"><span style="mso-spacerun:yes;">               
    </span>FpSpread1.ActiveSheet.ActiveRowIndex + 1 = rowCount </font><span style="color:blue;">Then</span></span>

    <span style="font-family:Consolas;font-size:12pt;"><font color="#000000"><span style="mso-spacerun:yes;">               
    </span>FpSpread1.ActiveSheet.AddRows(FpSpread1.ActiveSheet.RowCount, 1)</font></span>

    <span style="font-family:Consolas;font-size:12pt;"><font color="#000000"><span style="mso-spacerun:yes;">               
    </span>FpSpread1.ActiveSheet.SetActiveCell(FpSpread1.ActiveSheet.ActiveRowIndex
    + 1,</font></span>

    <span style="font-family:Consolas;font-size:12pt;"><font color="#000000"><span style="mso-spacerun:yes;">                                                   
    </span>firstColumn)</font></span>

    <span style="font-family:Consolas;font-size:12pt;"><span style="mso-spacerun:yes;"><font color="#000000">                </font></span><span style="color:green;">'New
    row Column Selected but not the last row, select first column in next row</span></span>

    <span style="font-family:Consolas;font-size:12pt;"><span style="mso-spacerun:yes;"><font color="#000000">            </font></span><span style="color:blue;">ElseIf</span><font color="#000000">
    FpSpread1.ActiveSheet.ActiveColumnIndex = newRowColumn </font><span style="color:blue;">And</span></span>

    <span style="font-family:Consolas;font-size:12pt;"><font color="#000000"><span style="mso-spacerun:yes;">               
    </span>FpSpread1.ActiveSheet.ActiveRowIndex + 1 <> rowCount </font><span style="color:blue;">Then</span></span>

    <span style="font-family:Consolas;font-size:12pt;"><font color="#000000"><span style="mso-spacerun:yes;">               
    </span>FpSpread1.ActiveSheet.SetActiveCell(FpSpread1.ActiveSheet.ActiveRowIndex
    + 1,</font></span>

    <span style="font-family:Consolas;font-size:12pt;"><font color="#000000"><span style="mso-spacerun:yes;">                                                   
    </span>firstColumn)</font></span>

    <span style="font-family:Consolas;font-size:12pt;"><span style="mso-spacerun:yes;"><font color="#000000">                </font></span><span style="color:green;">'Not
    the first or new row column, select the next column</span></span>

    <span style="font-family:Consolas;font-size:12pt;"><span style="mso-spacerun:yes;"><font color="#000000">            </font></span><span style="color:blue;">ElseIf</span><font color="#000000">
    FpSpread1.ActiveSheet.ActiveColumnIndex >= skipToColumn </font><span style="color:blue;">Then</span></span>

    <span style="font-family:Consolas;font-size:12pt;"><font color="#000000"><span style="mso-spacerun:yes;">               
    </span>FpSpread1.ActiveSheet.SetActiveCell(FpSpread1.ActiveSheet.ActiveRowIndex,<o:p></o:p></font></span>

    <font color="#000000" face="Times New Roman">

    </font>

    <span style="font-family:Consolas;font-size:12pt;"><font color="#000000"><span style="mso-spacerun:yes;">                                                   
    </span>FpSpread1.ActiveSheet.ActiveColumnIndex + 1)</font></span>

    <span style="font-family:Consolas;font-size:12pt;"><span style="mso-spacerun:yes;"><font color="#000000">            </font></span><span style="color:blue;">End</span><font color="#000000">
    </font><span style="color:blue;">If</span></span>

    <span style="font-family:Consolas;font-size:12pt;"><span style="mso-spacerun:yes;"><font color="#000000">        </font></span><span style="color:blue;">End</span><font color="#000000"> </font><span style="color:blue;">If</span></span>

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

    <span style="font-family:Consolas;font-size:12pt;"><span style="mso-spacerun:yes;"><font color="#000000">    </font></span><span style="color:blue;">End</span><font color="#000000"> </font><span style="color:blue;">Sub</span></span>

    <span style="color:blue;font-family:Consolas;font-size:12pt;">End</span><span style="font-family:Consolas;font-size:12pt;"><font color="#000000"> </font><span style="color:blue;">Class</span><o:p></o:p></span>

    <font color="#000000" face="Times New Roman">

    </font>

  • Replied 8 September 2017, 2:51 pm EST

    DeepakSharma

     <span id="result_box" class="short_text"><span class="hps">some</span> <span class="hps">example?</span></span>

     

  • Replied 8 September 2017, 2:51 pm EST

    Luis, According to the MSDN Library the KeyPress event is not fired for non-character keys, only the Keydown or Keyup events are fired for non-character keys, if you want to use the Keypress event you will need to use something other than the Enter key. See the link below.

    http://msdn.microsoft.com/en-us/library/system.windows.forms.control.keypress.aspx

  • Replied 8 September 2017, 2:51 pm EST

    Hi,

    Maybe these will help? 

    Managing Keyboard Interaction

    Managing Events from User Actions

    Those help context are from the user's guide.  The full documentation is here (and in the online help).

  • Replied 8 September 2017, 2:51 pm EST

    <span id="result_box" class=""><span class="hps">but</span> <span class="hps">you can</span> <span class="hps">give me</span> <span class="hps">an example</span> <span class="hps">with 6 columns</span><span>, please</span>

    <span class="hps">send</span> <span class="hps">you</span> <span class="hps">some pictures</span> <span class="hps">to your email</span> <span class="hps">thanks</span></span>

     

    helpme please

  • Replied 8 September 2017, 2:51 pm EST

    I can't give you an example using KeyPress
  • Replied 8 September 2017, 2:51 pm EST

    Paul

    quiero utilizar el evento keypress
    y no no keydown

     

    <span id="result_box" class=""><span class="hps">does not give</span> <span class="hps">the results I want</span>

    <span class="hps">I want to use</span> <span class="hps">the</span> <span class="hps">keypress</span> <span class="hps">event</span>
    <span class="hps">and</span> <span class="hps">no</span> <span class="hps">keydown</span></span>

    <span id="result_box" class="short_text"><span class="hps">A million thanks</span><span class="">, paul</span></span>

  • Replied 8 September 2017, 2:51 pm EST

    Hello,

    The code provided by you in the above post, for moving to specific columns using the KeyDown event would work correctly in both the cases, that is for Spread with 7 columns as well as for Spread with 10 columns. Please let me know if you still face any issues with this code or if you have any queries further.

    Thanks,

    Manpreet Kaur.

  • Replied 8 September 2017, 2:51 pm EST

    ok paul, can give me example with keydown,but 7 columns and other with 10 colums please.
    how the picture sent your mail thank.

    you send  my code.

    <b><u>"detalle_venta=fpspread"
    </u></b>

    <b><u>"this have 7 columns "
    </u></b>

     <u><b>this is correct?</b></u>

    <u><b><span id="result_box" class="short_text"><span class="hps alt-edited">no</span> <span class="hps">keypress</span></span></b></u>

    <img src="http://s2.subirimagenes.com/otros/previo/thump_7362913only-keypress-skip-c.jpg" title="keypress" alt="keypress" width="320" align="top" height="200"> 

    Private Sub detalle_venta_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles detalle_venta.KeyDown


            Dim newRowColumn As Integer = 3
            Dim firstColumn As Integer = 0
            Dim skipToColumn As Integer = 2
            Dim rowCount As Integer = detalle_venta.ActiveSheet.RowCount


            If e.KeyCode = Keys.Enter Then

                'First Column Selected, skip to specific column

                If detalle_venta.ActiveSheet.ActiveColumnIndex = firstColumn Then

                    detalle_venta.ActiveSheet.SetActiveCell(detalle_venta.ActiveSheet.ActiveRowIndex, skipToColumn)

                    'New row Column Selected in the last row, add row and select first column in it

                ElseIf detalle_venta.ActiveSheet.ActiveColumnIndex = newRowColumn And detalle_venta.ActiveSheet.ActiveRowIndex + 1 = rowCount Then

                    detalle_venta.ActiveSheet.AddRows(detalle_venta.ActiveSheet.RowCount, 1)

                    detalle_venta.ActiveSheet.SetActiveCell(detalle_venta.ActiveSheet.ActiveRowIndex + 1, firstColumn)

                    'New row Column Selected but not the last row, select first column in next row

                ElseIf detalle_venta.ActiveSheet.ActiveColumnIndex = newRowColumn And detalle_venta.ActiveSheet.ActiveRowIndex + 1 <> rowCount Then

                    detalle_venta.ActiveSheet.SetActiveCell(detalle_venta.ActiveSheet.ActiveRowIndex + 1, firstColumn)

                    'Not the first or new row column, select the next column

                ElseIf detalle_venta.ActiveSheet.ActiveColumnIndex >= skipToColumn Then
                    detalle_venta.ActiveSheet.SetActiveCell(detalle_venta.ActiveSheet.ActiveRowIndex, detalle_venta.ActiveSheet.ActiveColumnIndex + 1)

                End If

            End If

            e.Handled = True

        End Sub

    <u><b></b></u>

     

     

    <img src="http://s2.subirimagenes.com/otros/previo/thump_7362904fac.jpg" title="keydown" alt="keydown" width="320" align="top" height="200"> 

     <b><u>"detalle_factura=fpspread" </u></b>

    <u><b>this have 10 columns</b></u>

    <u><b>this is correct?</b></u>

    <u><b><span id="result_box" class="short_text"><span class="hps alt-edited">no</span> <span class="hps">keypress</span></span></b></u> <b><u>OK</u></b>

       Private Sub detalle_factura_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles detalle_factura.KeyDown

           Dim PrimeraColumnaCodigo As Integer = 0
            Dim ColumnaFecha As Integer = 4
            Dim ColumnaCantidad As Integer = 5
            Dim ColumnaPrecioneto As Integer = 6
            Dim rowCount As Integer = detalle_factura.ActiveSheet.RowCount

            If e.KeyCode = Keys.Enter Then

                'esta en la columna 0 de la fila activa
                If detalle_factura.ActiveSheet.ActiveColumnIndex = PrimeraColumnaCodigo Then
                    'saltamos a la columa de la fecha
                    detalle_factura.ActiveSheet.SetActiveCell(detalle_factura.ActiveSheet.ActiveRowIndex, 4)
                    MsgBox("FEcha")

                    ' si esta en la columna Fecha de la fila activa
                ElseIf detalle_factura.ActiveSheet.ActiveColumnIndex = 4 Then
                    'saltamos a la columna cantidad
                    detalle_factura.ActiveSheet.SetActiveCell(detalle_factura.ActiveSheet.ActiveRowIndex, 5)
                    'MsgBox("En cantidad")

                ElseIf detalle_factura.ActiveSheet.ActiveColumnIndex = 5 Then
                    'saltamos a la columna cantidad
                    detalle_factura.ActiveSheet.SetActiveCell(detalle_factura.ActiveSheet.ActiveRowIndex, 6)
                    'MsgBox("En Precio neto")

                    ' si esta en el precio neto

                ElseIf detalle_factura.ActiveSheet.ActiveColumnIndex = 6 Then

                    MultiplicaColumna()
                    CalculoTotal()

                    detalle_factura.ActiveSheet.AddRows(detalle_factura.ActiveSheet.RowCount, 1)
                    detalle_factura.ActiveSheet.SetActiveCell(detalle_factura.ActiveSheet.ActiveRowIndex + 1, 0)


                Else
                    MsgBox("nOSE QUE PASA ACA")
                    End If

            End If
            e.Handled = True


        End Sub

    sorry my English
     

     

     

     

     

     

Need extra support?

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

Learn More

Forum Channels