Hello GoTheAllBlacks.
New Zealander, eh ;-)
I have a character field as controlsource in a grid column with currently two dynamiccurrentcontrols set to either textbox or combobox. My question is I want to add a spinner dynamiccurrentcontrol as an option if the field is numeric.But i get an error of course for invalid type
Have you considered either having a pop up form for editing the data in the current grid row (you could pop up up from the grid's dblClick) or a set of controls on the form above the grid? This would cewrtainly simplify your problem and it would probably be an easier way for your users to enter data.
This way you could have all the controls on your form, all stacked one on top of the other and use a little code to determine which one was visible using their zOrder() methods and setting their Visible properties appropriatey.
As far as the spinner to bind to character data goes, there is a very good example that you can modify if you have a copy of 1001 Things You Wanted to Know About Visual FoxPro (
in Chapter 4:
The true time spinner (Example: CH04.VCX::spnTime)
This control looks and acts just like the time spinner you see when using the Date/Time Picker ActiveX control that ships with Visual Studio. However, it has several features that make it more generally useful than the ActiveX control. First, this control does not require that it be bound to a field of the DateTime data type. As we have said, the best format for storing user entered time is in a character field formatted to include the universal ‘:’ time separator. The control can be configured to display and recognize either a 5-character ‘hh:mm’ format or a full 8-character ‘hh:mm:ss’ format and update either appropriately. This is controlled by a single property, lShowSeconds. Finally, because this is a native Visual FoxPro control it does not suffer from the inherent problems that haunt ActiveX controls with respect to the multiple versions of specific windows DLLs, nor are there any problems associated with registering the control.
This control uses a cControlSource property for binding to an external data source and has associated methods (RefreshSpinner and UpdateControlSource) to handle the issue of converting between character (source) and numeric (internal) values and back. The UpdateControlSource method, called from the spinner's Valid method, allows the time spinner, which is really an unbound control, to behave just like one that is bound when its cControlSource property is set.
Conversely, the RefreshSpinner method updates the spinner's value from its cControlSource. In true bound controls, this function is handled automatically whenever the control is refreshed. Our RefreshSpinner method is called from the spinner's Refresh to provide this functionality.
Marcia G. Akins