In general, you can put validation code in a TextBox Valid() Event. If a condition is not fulfilled, return .F. to avoid losing the focus.
In the case of a grid, you might also try the BeforeRowColChange() Event. In this case, if the condition is not fulfilled, use the command NODEFAULT to avoid losing the focus.
>hi all,
>i need help to stop arrow up or arrow down at mygrid if the result via my code is false
>
> m.a=thisform.timeadd(thisform.timeadd(thisform.timeadd(thisform.timeadd(true,hot),balanc),mint),other)
> m.w=thisform.timeadd(plan,("00:00:00"))
>IF m.a=m.w and m.a>"00:00:00" and m.w>"00:00:00"
> *=MessageBox("true")
> grdTable = thisform.Grid1.RecordSource
> thisform.Grid1.column7.SetFocus()
> SKIP IN (grdTable)
> IF EOF()
> SKIP -1 IN (grdTable)
> ENDIF
>
>ELSE
> =MessageBox("false")
> thisform.Grid1.column7.SetFocus()
>ENDIF
>
>
>thanks
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)