MultiRow Windows Forms > Developer's Guide > Using MultiRow > User Input Validation > Built-in Validation Actions > Notification using Focus Change (FocusProcess) |
You can use FocusProcess to control the focus movement and keep it in the current cell when a validation error occurs.
Complete the following steps to use FocusProcess for cell validation.
The following code keeps the focus in the textBoxCell when the cell's value is blank.
Imports GrapeCity.Win.MultiRow Dim textBoxCell1 As New TextBoxCell() Dim requiredFieldValidator1 As New RequiredFieldValidator() Dim focusProcess1 As New FocusProcess() requiredFieldValidator1.Actions.Add(focusProcess1) textBoxCell1.Validators.Add(requiredFieldValidator1) Dim cells As Cell() = {textBoxCell1} GcMultiRow1.Template = Template.CreateGridTemplate(cells) GcMultiRow1.RowCount = 10 |
using GrapeCity.Win.MultiRow; TextBoxCell textBoxCell1 = new TextBoxCell(); RequiredFieldValidator requiredFieldValidator1 = new RequiredFieldValidator(); FocusProcess focusProcess1 = new FocusProcess(); requiredFieldValidator1.Actions.Add(focusProcess1); textBoxCell1.Validators.Add(requiredFieldValidator1); Cell[] cells = { textBoxCell1 }; gcMultiRow1.Template = Template.CreateGridTemplate(cells); gcMultiRow1.RowCount = 10; |