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

Member Avatar for Unhnd_Exception

No.

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

Placing a Label over the DateTimePicker could do the trick.

can i have the codes for the label?

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.

commented: thanks +1

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
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.