General information
Category:
Forms & Form designer
>>realize this was discussed last month. but it is relevent to my work today. in my valid i also want to setfocus. a little confused about the "on error". i tried this and still got the vfp error message. do i have to "on error" something to throw away the vfp runtime error?
>>
>>
>>GRID1.COLUMN3.VALID
>>do column4_valid
>>this.column4.setfocus() && get vfp runtime error
>>
>>
>>PROCEDURE COLUMN4_VALID
>>on error && did not say anything else
>>return
>>
>>thanks - brenda
>
>Brenda,
>
>You canno0t call setfoucs form Valid or When at all absolutely ever under any conditions. You need to do the SetFocus call in the Control's LostFocus evetn for the control in the column. Using the Lostfocus event you also need to issue a nodefault command as in;
>
>* Column.Text1.LostFocus
>THIS.Parent.Parent.Columns(1).SetFocus()
>NODEFAULT
Jim -
I just wanted to add my thanks for this tip, which was the answer to my problem. I have a cities combobox which allows user to use incremental search to find existing cities or add a new one by instantiating a data entry form class for cities in the valid. My problem was that my cities form class itself included a setfocus to its control, and was generating the error in the valid event of my combo box. I tried moving my validation code (and instantiation) to the lost focus, which did prevent the valid error, but until I added the NODEFAULT, I was of course losing focus and not validating. Like Brenda, I too have used NODEFAULT before, but it hadn't occured to me to use it in this case. This was a simple, yet valuable piece of info.
Thanks again,
Sylvia
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only