mardi 31 mai 2022

How to display error message when user pick more than 1 day then click the checkbox for halfday?

I have two datepicker which are datepickerFrom and datepickerto. I want to show an error message when user pick more than 1 day and check the half day checkbox then click button submit it will show and error message.

For example : A pick 1/6/2022 - 3/6/2022, then A click check box for half day. When A clicked the submit button it'll show an error message like 'Sorry, You can't pick more than 1 date for half day!'

Here is my code for my checking error

Private Function ErrorFree() As Boolean 

If datepickerFrom.Date > datepickerto.Date Then 
   If chkHalfDay.Checked = True Then 
       DisplayMessage("error", "ERROR", "Sorry, You can't pick more than 1 date for half day!")
   Return False
   Exit Function
   End If
End If
Return True
End Function



Aucun commentaire:

Enregistrer un commentaire