使用dateTimePicker的大写月份

时间:2014-02-09 22:55:19

标签: .net winforms

我正在尝试使用dateTimePicker以ddMMMyyyy格式显示日期,但是以大写字母显示,例如01JAN2014,而不是ddMMMyyyy提供的01Jan2014。

为了澄清,我希望dateTimePicker以此(大写)格式显示所选值,而不是简单地从中获取大写结果。

1 个答案:

答案 0 :(得分:0)

最简单的方法。

Private Sub Form1_Load(sender As System.Object,e As System.EventArgs)处理MyBase.Load

    DateTimePicker1.Format = DateTimePickerFormat.Custom
    DateTimePicker1.CustomFormat = Strings.UCase(Format(DateTimePicker1.Value, "ddMMMyyyy"))

End Sub

Private Sub DateTimePicker1_ValueChanged(sender As Object,e As System.EventArgs)处理DateTimePicker1.ValueChanged

    DateTimePicker1.CustomFormat = Strings.UCase(Format(DateTimePicker1.Value, "ddMMMyyyy"))

End Sub