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)