Hi Mike
You could also conditionally add a validation object to the textbox. This would be done at runtime. Debugging Execscript can be difficult. Classes already in your exe are not directly available to exescripts called from that exe.
>Hi James,
>
>Thanks for the reply.
>
>I dug around a little further and found the EXECSCRIPT(). After playing with it, I think that I can make it do what I need. What I did so far was create a custom property for the textbox class named ValidateCode. I put a string of VFP commands in it based on the specific column I'm in and in the textbox class Valid() method, I have:
>
>
>IF !EMPTY(this.ValidateCode)
> EXECSCRIPT(this.ValidateCode)
>ENDIF
>
>
>So far, it seems to do the trick.
>
>Mike
>
>
>>Hi Mike
>>
>>As far as I know, you can't add code at runtime. What I do is add two properties in my column class that I use to addobject() my text box at runtime. Then you can subclass a textbox with the code you wish to run.
>>
>>
>>>I have a column member class that I use in my grids. The column member class adds a textbox class in the Init() event using Addobject().
>>>
>>>The textbox class has no code in its Valid() event. What I'd like to have happen is to somehow add code (at runtime) to the textbox's Valid() event so that a different validation is run for each column.
>>>
>>>I thought that the textbox's WriteExpression() method looked like a promising solution, however, it is only for design time :(
>>>
>>>Is there any way to do what I described?
>>>
>>>TIA
>>>
>>>VFP8SP1, Win200Pro
>>>
>>>Regards,
>>>
>>>Mike