Habanero.Faces.Win.DateTimePickerUtilWinTemp.SetCustomFormat C# (CSharp) Method

SetCustomFormat() public static method

Specify the custom format for the given date-time picker
public static SetCustomFormat ( Control dateTimePicker, string customFormat ) : void
dateTimePicker System.Windows.Forms.Control The date-time picker
customFormat string The custom format to set for the date-time picker
return void
		public static void SetCustomFormat(Control dateTimePicker, string customFormat)
		{
			if (dateTimePicker.GetType().Name == "UltraDateTimeEditor")
			{
				PropertyInfo propInfo =
					dateTimePicker.GetType().GetProperty("FormatString", BindingFlags.Instance | BindingFlags.Public);
				propInfo.SetValue(dateTimePicker, customFormat, new object[] { });
			}
			else if (dateTimePicker is DateTimePicker)
			{
				DateTimePicker picker = (DateTimePicker)dateTimePicker;
				picker.Format = DateTimePickerFormat.Custom;
				picker.CustomFormat = customFormat;
			}
		}