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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Hand Entering Date in DateTimePickerAdv

Thread ID:





58092 Mar 17,2007 08:36 PM UTC Mar 19,2007 07:30 PM UTC WinForms 1
Tags: GridControl
Tom Affholter
Asked On March 17, 2007 08:36 PM UTC

VS2003 - VB
SQL 2000
Essential Studio 3.3

In a grid, can a MonthCalendar control column, bound to a SQL date field, be formatted to accept a 6 or 8 digit numeric date (031607 or 03162007) and supply the slashes and century if necessary?


Administrator [Syncfusion]
Replied On March 19, 2007 07:30 PM UTC

Hi Tom,

There is no property setting that will handle this problem. I think the simplest way to do this is to use the CurrentCellValidateString event in grid. Below is one way you can do it.

Dim validFormats() As String = {"MM/dd/yy","MM/dd/yyyy"} ''''your acceptable formats.

Private Sub gridDataBoundGrid1_CurrentCellValidating(sender As Object, e As System.ComponentModel.CancelEventArgs)

Dim cc As GridCurrentCell = Me.gridDataBoundGrid1.CurrentCell
If cc.ColIndex = 3 Then
Dim dt As DateTime = DateTime.ParseExact(cc.Renderer.ControlText, validFormats, Nothing, System.Globalization.DateTimeStyles.None)
cc.Renderer.Control.Text = dt.ToString()
cc.ErrorMessage="Invalid Date Format"

End Try
End If
End Sub ''''gridDataBoundGrid1_CurrentCellValidating

Please let me know if this helps.



This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon