>ControlSource
Yes, that's the other thing you can use, I also explained that. I left it out this time, as it wasn't the accepted solution. It takes a bit more work, but you can define an object with properties to bind to several controls and then can pass on the object, which I often do in otherwise unbound forms, eg forms, where users may enter data filter values.
Code:
oFilter = CreateObject("empty")
Addproperty(oFiler,"nNumber",CAST(.NULL. As Int))
Addproperty(...) && other properties to bind other controls
* finally store oFilter as a form property, to keep it "alive"
Thisform.Addproperty("oFilter",oFilter)
Thisform.txtmynumber.controlsource = "Thisform.oFilter.nNumber"
What displays then is also blank, if you SET NULLDISPLAY TO ""
Overall this work the same as a nullable integer field. You can define any type with CAST.
Later you can work with Thisform.oFilter properties in queries etc. instead of thisform.somcontrol.value or even thisform.pageframe1.pag3.grid1.colum4.text1.value.
Caution: If you define a property as int this way it's still float. Also, if you define a property as C(20) via cast, you still can store Space(30). As Mike said, VFP isn't strong typed. But what works is, you have a property with no value (.NULL. denotes that), but still having a type (N,C,D,T,... all the normal variable types are possible). And though you still can set oFilter.nNumber = "abc" programmatically. If you keep it at a "numerically typed .NULL.", the textbox is blank and will detect the type of the controlsource as N and only allow numbers. That's the more advanced solution than Format "Z", as that allows blank controls for any type, of course.
Bye, Olaf.