I have an application in which I need to be able to handle partial dates.
That is a partial dates like 09-2005 where 09 is the month and 2005 is the year.
Ideally there would be an ability to configure a control to understand that _ _-09-2005 = 01-09-2005 (dd-mm-yyyy) , but not display the 01 for the day. equally _ _- _ _ - 2005 would become 01-01-2005 with a flag set to 1 to indicate that only the year part is valid
I am intending to store the date in a date column with a data validity column 1 = Year, 2 = Year and Month and 3= Year, Month and Day
Any suggestions as to the best way to handle this or do's and dont's would be grealy apprecaited.
Thank you
The DateTImeEditor can't handle this because it deals with dates, which require an explicitly defined day month and year.
You can probably do this using an UltraMaskedEditor control with a regular numeric mask like "nn-nnnn", and then when it comes time to get a date out of the string value entered by the user, parse the text with a "01" inserted between the month and year, so that the value can be parsed as if it were a date.
Iam wondering if there has been any update to this
I have the following code
Dim ude As New UltraDateTimeEditor With orow If .IsDataRow Then If .Cells.Exists("Date Type") Then Select Case .Cells("Date Type").Text Case "Full Date" If .Cells.Exists("Date") Then With ude '.ButtonStyle = UIElementButtonStyle.Button3D '.DropDownStyle = DropDownStyle.DropDown '.DisplayStyle = EmbeddableElementDisplayStyle.Office2013 .FormatString = "dd-mm-yyyy" .MaskInput = "dd-mm-yyyy" .Nullable = True '.NullText = "[No Date Selected]" .SpinButtonDisplayStyle = Infragistics.Win.ButtonDisplayStyle.Always ' .Value = Today.Date End With End If Case "Month and Year" If .Cells.Exists("Date") Then With ude .FormatString = "mm-yyyy" .MaskInput = "mm-yyyy" ' .Nullable = True ' .NullText = "[No Date Selected]" .SpinButtonDisplayStyle = Infragistics.Win.ButtonDisplayStyle.Always ' .Value = Today.Date End With End If Case "Year Only" If .Cells.Exists("Date") Then With ude ' .ButtonStyle = UIElementButtonStyle.Button3D ' .DropDownStyle = DropDownStyle.DropDown ' .DisplayStyle = EmbeddableElementDisplayStyle.Office2013 .FormatString = "yyyy" .MaskInput = "yyyy" ' .Nullable = True ' .NullText = "[No Date Selected]" .SpinButtonDisplayStyle = Infragistics.Win.ButtonDisplayStyle.Always ' .Value = Today.Date End With End If
and it almost works but Month and Year while okay when editttng are set back to 00-2019 after edit
and .FormatString = "yyyy" is okay on format but .MaskInput = "yyyy" does not allow just the yyyy but will sort of work with mm-yyyy as masinput to disply yyyy
So close and yet so far.... Thank you in advance for any feedback