Home Forums WinForms controls Xceed Grid for WinForms Update on another cell when the cell value is changed??

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

    Hi,

    How to have a calculation on another cell after the cell is changed?

    For example, when user changes or enter Food_Count value, I need the Food_Amount columns to be changed in database automatically:
    Food_Amount = Food_Count * 0.8

    How to do it?
    —————————————-

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    builder = New SqlCommandBuilder
    Dim DBstrQ As New SqlCommand(“”, conDWDb)
    DBstrQ.CommandText = “SELECT Bus_Date AS Bus_Date, Store_Num , Z_Num_Transactions, Net_Sales, Net_Food_sales, Food_Count, Z_Sales_Tax_Amt FROM micros.Operations where store_num=@storenum”
    adpSales.SelectCommand = DBstrQ
    adpSales.SelectCommand.Parameters.Add(“@StoreNum”, System.Data.SqlDbType.VarChar, 7)
    adpSales.SelectCommand.Parameters(“@StoreNum”).Value = txtStoreNum.Text
    builder.DataAdapter = adpSales
    adpSales.UpdateCommand = builder.GetUpdateCommand
    adpSales.InsertCommand = builder.GetInsertCommand
    dsSales = New DataSet(“Operations”)
    adpSales.Fill(dsSales, “Sales”)
    Try
    GridControl1.BeginInit()
    GridControl1.DataSource = dsSales
    GridControl1.DataMember = “Sales”
    Dim filterRow As New Xceed.Grid.ValueRow
    GridControl1.FixedHeaderRows.Add(filterRow)
    GridControl1.EndInit()
    AddHandler dsSales.Tables(“Sales”).RowChanged, AddressOf Me.Sales_RowChanged
    AddHandler dsSales.Tables(“Sales”).ColumnChanged, AddressOf Me.Sales_ColChanged
    Catch ex As Exception
    MsgBox(ex.Message)
    End Try
    End Sub

    Imported from legacy forums. Posted by JenHu (had 2103 views)

    User (Old forums)
    Member
    Post count: 23064

    I am not sure I understand correctly your question. You would like to modify the value of a certain cell prior to updating your dataBase and only then? Otherwise you could use the leavingEdit of the Cell and make you calculation changes there? Can you give me more details?

    Imported from legacy forums. Posted by Matt (had 2958 views)

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