I've done something similar with the DataGrid's .CurrentCellCha nged event.
It might look something like this:
Private Sub dgPayroll_Curre ntCellChanged(B yVal sender As Object, ByVal e As
System.EventArg s) Handles dgPayroll.Curre ntCellChanged
' 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.Current Cell.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.ToSingl e(curGrid.Item( curRow, 1))
curGrid.Item(cu rRow, 2) = monthlyPay * 12.0
Catch
End Try
End Sub
"Arsalan" <ar***********@ hotmail.com> wrote in message
news:%2******** *******@TK2MSFT NGP15.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?