Home Forums WinForms controls Xceed Grid for WinForms Working with values in a combo bound/unbound grid

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #14979 |

    I have a Grid that has a mostly bound columns with a pair of unbound columns, plus several hidden bound columns. It is an order entry screen so what I want to do it have them enter a number into a cell then when that value changes do a couple things, one some logic to say if it is backorder or not, second create a line subtotal, and third update another grid that has # of item subtotals and dollar subtotals.

    I am using celldataRowTemplate1QuantityOnOrder.LeavingEdit, which seems to fire when a cell is leaving edit mode (go figure). Here is my code in that Sub:

    celldataRowTemplate1QuantityOnOrder.Value = e.NewValue
    celldataRowTemplate1QuantityOnOrder.EnterEdit()
    celldataRowTemplate1QuantityOnOrder.LeaveEdit(True)

    Dim r As Xceed.Grid.DataRow
    Dim count As Decimal
    For Each r In GridControl1.DataRows

    If r.Cells(“colQuantityOnOrder”).Value <> 0 And Not r.Cells(“colQuantityOnOrder”).Value Is DBNull.Value Then
    Debug.Write(r.Cells(“colQuantityOnOrder”).Value.ToString)
    count = r.Cells(5).Value + count

    End If

    Next

    The first part is trying to fix the problem that my data keeps disappearing. It seems to happen when I try to loop through the values of the column. When I had it set for the wrong column it worked just fine. Second, it seems that only the first line of the Subroutine fires and if it goes into a loop it seems to exit the loop after the first time through, it never hits the “next”.

    I am very confused as to what is happening here and any help is appreciated.

    Thanks,
    Douglas

    Imported from legacy forums. Posted by Douglas (had 1824 views)

    User (Old forums)
    Member
    Post count: 23064

    First, the EditLeft event on the cell may be more suitable for your needs. That is, at the time of this event, the new value IS committed to the cell, thus you would not need to assign the new value to cell, and entering and leaving the edit mode.

    Second, you are using the cell template in the event handler(celldataRowTemplate1QuantityOnOrder), instead of the actual cell being edited. Use the sender to get the cell itself, by casting it to a DataCell (if you need the cell).

    e.g.:

    CType( sender, Xceed.Grid.DataCell )
    or
    ( ( Xceed.Grid.DataCell )sender);

    Third, you should have no problem looping through your DataRows in the handler. If using the EditLeft event does not solve your problem, I suggest you send a sample application reproducing your issue to <a href=”mailto:support@xceedsoft.com”>support</a>, so we can investigate this further.

    Imported from legacy forums. Posted by André (had 3010 views)

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.