We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Formatting Date Text in MonthCalendar

I have an issue formatting text entered in a MonthCalendar in a databound grid. I''m using the following code: Private Sub grdDetail_CurrentCellValidating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles grdDetail.CurrentCellValidating Dim cc As GridCurrentCell = Me.grdDetail.CurrentCell If cc.ColIndex = 3 Then If IsNumeric(cc.Renderer.ControlText) Then cc.Renderer.ControlText = String.Format("{0:##/##/####}", CType(cc.Renderer.ControlText, Integer)) End If End If End Sub This actually works great in formatting the text entered by a user. However, when a user enters a date in the field, tabs to the next field and the tabs back to the date field and clears the date out if the field the control throws a date format error. The only way to get out of the field is to enter a date or hit the escape key. If I have no code in the CurrentCellValidating event this does not happen. Any hint on how I can still format a date entered and not have this error happen when they clear the field? Thanks

1 Reply

AD Administrator Syncfusion Team February 9, 2005 12:05 PM

Hi Chris, I tried reproducing it and created a small sample but that seems to be fine. I am probably missing something. Can you upload a small sample project with steps how to provoke the behavior? If upload does not work send it to support@syncfusion.com Thanks, Stefan

Loader.
Live Chat Icon For mobile
Up arrow icon