• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1890
  • Last Modified:

VB.Net datetimepicker control - how to change the textbox forecolor

This should be easy but I can't figure it out.  With VB.Net how do you change the forecolor of the datetimepicker textbox?  

I can see various properties that can be used to change the colors of the calendar but I can't see a property for changing the forecolor of the date that is displayed in the text box once the user has picked the date.

0
ccravenbartle
Asked:
ccravenbartle
1 Solution
 
Bob LearnedCommented:
It doesn't have that property.

Bob
0
 
ccravenbartleAuthor Commented:
Rats.  This is a bit of a blow.  My program compares the date selected with another date and, if it is earlier than the other date, the date is accepted but displayed in red to warn the user that there may be a problem.  Any ideas on how I could do this if there is no forecolor text property available with the datetimepicker?
0
 
ZeonFlashCommented:
Have you thought of using the ErrorProvider?

ErrorProvider1.SetError(DateTimePicker1, "Warning Message!")

It will show an icon next to the date time picker, and provide the warning message as a tooltip.

At the very least, you could hide/unhide a label above the control.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Éric MoreauSenior .Net ConsultantCommented:
See an article I wrote in July 2005 at http://emoreau.s2i.com/
0
 
Bob LearnedCommented:
Eric,

What did that article say about ForeColor?

Bob
0
 
Éric MoreauSenior .Net ConsultantCommented:
It shows how to override the OnPaint method of the DateTimePicker to draw the string the way (and the color) you want.
0
 
Bob LearnedCommented:
Cool b-)  Thanks :D

Bob
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now