Please tell me where i am doing mistake in the following code? nothing happens when value changed.
Private Sub frmProduct_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Try fillGrid() Dim cell As DataCell For Each cell In grdReceipts.DataRowTemplate.Cells If cell.FieldName = “add_qty” Then AddHandler cell.ValueChanged, AddressOf validateQty End If Next cell Catch ex As Exception MsgBox(ex.Message) End Try End Sub
Private Sub fillGrid() Try sqlQry = “sql query goes here…” Dim stockDS As New DataSet() sqlDa.SelectCommand = New SqlCommand(sqlQry, sqlCon) sqlDa.Fill(stockDS, “stocks”) Dim i As Integer For i = 0 To stockDS.Tables(“stocks”).Rows.Count – 1 Dim row1 As Xceed.Grid.DataRow = grdReceipts.DataRows.AddNew() row1.BeginEdit() row1.Cells(“code”).Value = stockDS.Tables(“stocks”).Rows(i).Item(0) row1.Cells(“desc”).Value = stockDS.Tables(“stocks”).Rows(i).Item(1) row1.Cells(“pack”).Value = stockDS.Tables(“stocks”).Rows(i).Item(2) row1.Cells(“add_qty”).Value = “” row1.EndEdit() Next Catch ex As Exception MsgBox(ex.Message) End Try End Sub
Imported from legacy forums. Posted by PETE (had 2200 views)
I take it that the grid is using the dataset as a datasource? The problem might be that the Cell_ValueChanged event does not fire when the value of the cell changes due to a change in the datasource. It only fires if the cell value is modified directly, e.g. a new value entered into a non read only cell by the user.
Hope this helps,
Imported from legacy forums. Posted by David (had 3103 views)