Hi All,

Can I put text in datetimepicker.

Instead of it showed the dafault date and time (today's date), can I put text like e.g
- Please Select Date -


Looking forward to hear from u guys soon...


URGENT

No.

Don't forget to mark threads as solved that have answered your question.

Edited 5 Years Ago by Unhnd_Exception: n/a

Hi,

Add a label in designtime and place it above the datetimepicker, just like Codeorder showed.

In the properties of the label set the text: - Please Select Date - and the textalign = center.

That's all.

Comments
thanks

Also, set the Label's AutoSize = False in the Label's Properties.
This will let you resize the Label.

If you need code, see if this helps.
1 DateTimePicker, 1 Label

Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        With Label1
            .BackColor = Color.White  '// keep color of DateTimePicker.
            .AutoSize = False '// allow's resizing of Label.
            .Size = New Size(DateTimePicker1.Width - 80, 16) '// sized to fit the DateTimePicker's window.
            .Text = "- Please Select Date - " '// your text.
            .TextAlign = ContentAlignment.MiddleCenter '// align text.
            .Location = New Point(DateTimePicker1.Location.X + 5, DateTimePicker1.Location.Y + 2) '// place Label in proper location.
            .BringToFront() '// bring to front if needed.
        End With
    End Sub
End Class
This article has been dead for over six months. Start a new discussion instead.