Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do i select a..

Status
Not open for further replies.

RocAFella2007

Technical User
Mar 21, 2007
45
GB
..date from the date/time picker when it must be equal to or greater than a date in a textbox, bearing in mind that the date in this textbox can change daily?

Any suggestions please?

(the chosen date gets displayed in a textbox but I have this part working)

Thanks
 
I have two suggestions. They both use the same method, but it depends on how your data is.

If when the form is opened the textbox already has the date in it, you can use the Form_Load event. In this event, set the MinDate property of the DateTimePicker to the date in the textbox...

Me.DateTimePicker1.MinDate = Convert.ToDateTime(Me.TextBox1.Text)

If the date is something entered by the user into the textbox, you could use the TextBox_Leave event or other event that meets your needs to do the same basic thing.

These methods allow the users to still scroll through the DateTimePicker, but they cannot select any date prior to the MinDate property.

=======================================
People think it must be fun to be a super genius, but they don't realize how hard it is to put up with all the idiots in the world. (Calvin from Calvin And Hobbs)

Robert L. Johnson III
CCNA, CCDA, MCSA, CNA, Net+, A+, CHDP
VB/Access Programmer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top