reset the initial value of a datetimepicker control

T

toufik

Hi,

In the ValueChanged event of a dateTimePicker control I've a condition, and
I like to reset the initial value if teh condition is false

Private Sub dateDebut_ValueChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles dateDebut.ValueChanged

if dateDebut.value.date < refDate then

<message>

<reset tho initial value>......how to do this?????????

end if

end sub

Any help please??

Thanks.
 
A

Armin Zingler

toufik said:
In the ValueChanged event of a dateTimePicker control I've a
condition, and I like to reset the initial value if teh condition is
false

Private Sub dateDebut_ValueChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles dateDebut.ValueChanged

if dateDebut.value.date < refDate then

<message>

<reset tho initial value>......how to do this?????????

end if

end sub

What is the "initial value"? The current date? If yes:

datedebut.value = date.today


--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html
 
H

Herfried K. Wagner [MVP]

* "toufik said:
In the ValueChanged event of a dateTimePicker control I've a condition, and
I like to reset the initial value if teh condition is false

Private Sub dateDebut_ValueChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles dateDebut.ValueChanged

if dateDebut.value.date < refDate then

<message>

<reset tho initial value>......how to do this?????????

Add a private variable of type 'Date' and assign the datetimepicker's
value to this variable if its valid. Then you can restore it easily if
an invalid date is selected.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top