Hi, I have written some coding that will not allow the dtp to select a date before today. It changes the date to todays date and shows a msgbox say "This date has passed, please select another".
I need to insert it into the valuechanged sub, so that it checks everytime the dtp changes.
What happens is --> that the msgbox appear twice. I have thought about it and realise that as it the script realises that the date is before todays date , it changes the value to todays date it and as it changes it runs the script again to check if the date is before todays and finds the previous date and the msgbox appears again.
VB Code:
Private Sub Ffrom_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Ffrom.ValueChanged If Ffrom.Value < Now() Then Ffrom.Value = Now() MsgBox("This date has passed, please select another") End If End Sub
I may be wrong, I have only been started learning vb a few weeks ago.
Thanks,
Mutasim





Reply With Quote