DatePicker control in VFP grid doesn't show after picking date and column loses focus.

Effortless used Ask the Experts™
I am trying to use the Microsoft Date and Time Picker 6.0 ActiveX object in a VFP 9 gridview control. The control works when the cell/column has focus, but I cannot see the value in the cell after the focus moves to the next column. I have tried the SPARSE  property of the column, which hasn't made any difference.

What must I do to see the cell contents after the cell loses focus?

I've attached two images of the cell, one with focus, the other without.

Cell with Date Picker control in focus

Cell when focus has moved to another cell
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
The Sparse property does work for native FoxPro controls only. ActiveX controls ignore it.

One possible solution could be to place two controls into the column and make active the ActiveX one when the cell has focus and the standard VFP textbox when you leave the column.

Another solution is to use native VFP calendar control. Source code is available here:

I didn't test above solutions.


Thank you for your help, I did not realize that about ActiveX and Sparse.

I would like to try the two controls solution you suggest as a possible solution - which method/event(s) do you think I could use to set the CurrentControl property of the column? I wanted to try GotFocus on the column, but that doesn't exist...


Thank you pcelba, I was able to change the CurrentControl in the GotFocus of text1 to OleControl1, and then back to Text1 on LostFocus of OleControl1. This works!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial