Hello,
I have set the date/time format and mask on some columns in a grid and when the date is put in and first saved it displays correctly, but after the screen is left and returned to the date is then displayed in the localized windows format rather than the format I specified. I am setting the properties in this manner:
topologyBand.Columns["TargetPhysicalSeparationDate"].Format = "MM/dd/yyyy hh:mm tt";topologyBand.Columns["ActualLogicalSeparationDate"].Format = "MM/dd/yyyy hh:mm tt";topologyBand.Columns["ActualPhysicalSeparationDate"].Format = "MM/dd/yyyy hh:mm tt";topologyBand.Columns["TargetPhysicalSeparationDate"].MaskInput = "mm/dd/yyyy hh:mm tt";topologyBand.Columns["ActualLogicalSeparationDate"].MaskInput = "mm/dd/yyyy hh:mm tt";topologyBand.Columns["ActualPhysicalSeparationDate"].MaskInput = "mm/dd/yyyy hh:mm tt";
The user is seeing the date as dd/mm/yyyy instead. This is only affecting the one user in the London area.
Thanks,
Don
Hi Don,
I can't think of any reason why this would happen, unless something in your code is blowing away the Format and MaskInput. Perhaps your code is loading a Layout into the grid and it's losing these settings? Or maybe you are setting the grid's DataSource property and losing your layout.
I do not think the format is being lost or overwritten, as before I added the .Format = "MM/dd/yyyy hh:mm tt"; code, the time was not displaying at all. Is the addition of that code supposed to take precedent over the computer OS's localization settings?
Hi,
drolfson said:Is the addition of that code supposed to take precedent over the computer OS's localization settings?
Yes.
Just as a test, I would try putting a button on the form that display the Format and MaskInput of the column at run-time. That way you can be sure they are not getting lost or reset.
Is it both that are getting lost? Format only applies to cells that are NOT in the edit mode and MaskInput applies only to cells that are in edit mode. So are all of the cells in the column losing the formatting or only the active cell?
If it's both, then another possibility is that you are assigning an Editor or EditorComponent to the column and you are assigning an editor that doesn't support masking/formatting. Or maybe you are setting some other property on the column which is changing the editor, like ValueList or Style.
Hello drolfson,
Could you please let us know if you are using an 'EditorComponent', 'ValueList' or 'Style' set to something?
Please do not hesitate to contact me if you need any additional assistance.
I am checking about the progress of this issue. Please let me know If you need any further assistance on this.