I've done something similar with the DataGrid's .CurrentCellChanged event.
It might look something like this:
Private Sub dgPayroll_CurrentCellChanged(ByVal sender As Object, ByVal e As
System.EventArgs) Handles dgPayroll.CurrentCellChanged
' This routine automatically calculates the Yearly Salary based on the
' Monthly Pay amounts entered
' First we locate our current edited cell and get the row
Dim curGrid As DataGrid = CType(sender, DataGrid)
Dim curRow As Integer = curGrid.CurrentCell.RowNumber
' Then we get the gross pay and withholding from that row and
' calculate the net pay. We put it in a try..catch block to catch
' null values.
Try
' Assumes Monthly Pay is entered in column 1
' and Yearly Salary goes into column 2
Dim mothlyPay As Single = Convert.ToSingle(curGrid.Item(curRow, 1))
curGrid.Item(curRow, 2) = monthlyPay * 12.0
Catch
End Try
End Sub
"Arsalan" <ar***********@hotmail.com> wrote in message
news:%2***************@TK2MSFTNGP15.phx.gbl...
How do I validate inputs in DataGrid ? I want to check for constraint and
change columns value dynamically,
for e.g i've column named employee, annual salary and salary
I want the columns annual salary to be dynamically changed when user
changes salary in datagrid
How do I do it?