************************************************** *-- Class: cnttimecontrol *-- ParentClass: container *-- BaseClass: container *-- Time Stamp: 09/04/99 12:42:00 PM *-- Control to get a time in AM, PM notation * Define CLASS cnttimecontrol AS container Width = 78 Height = 23 BackStyle = 0 BorderWidth = 0 Name = "cnttimecontrol" *-- Holds control source ControlSource = .F. Add OBJECT txttime AS textbox_ WITH ; ControlSource = "", ; Left = 0, ; TabIndex = 11, ; Top = 0, ; Width = 77, ; loverridewidth = .T., ; Name = "txtTime" Add OBJECT oletime AS olecontrol WITH ; Top = 0, ; Left = 0, ; Height = 20, ; Width = 77, ; Visible = .F., ; Name = "OleTime" Procedure Init With this .txttime.controlsource = .Controlsource .txttime.init() .oletime.Init() Endwith Endproc Procedure txttime.GotFocus Nodefault This.visible = .f. With this.Parent.oletime .visible = .t. .Setfocus() Endwith Endproc Procedure oletime.Init This.Second = 0 With this.Parent.txttime If !empty(.value) This.Hour = hour( ctot(dtoc(date())+" "+.value)) This.Minute = minute(ctot(dtoc(date())+" "+.value)) Else This.Hour = 0 This.Minute = 0 Endif Endwith Endproc Procedure oletime.LostFocus This.visible = .f. With this.Parent.txttime .value = ttoc(ctot(dtoc(date())+; " "+padl(this.hour,2,"0") + ; ":"+ padl(this.minute,2,"0")),2) .visible = .t. .valid() .refresh() Endwith Endproc Enddefine * *-- EndDefine: cnttimecontrol **************************************************Oletime is DT control. I never used this in a grid but I think should work. Lemme know too.