Hello group, it’s been a while since I wrote. I would like to check if an entered number and a valid date, I wrote this code. Do you think it can go? or can it be improved?
As a valid year range I have given from 1900 to the current year.
Dim ReadYear as integer
Dim InitYear as integer
var CurrentYear as datetime=datetime.Now
if IsNumeric(TextField1.Text)=True then ' Is is Numeric i verified if is date
ReadYear=integer.FromString(textField1.Text)
if ReadYear<=1900 or ReadYear>=(CurrentYear.Year+1) then
msgbox " Attenzione, si accettano date superiori al 1900 e minori o uguali all'anno in corso"
else
if MsgBox("Eliminare tutti i dati in magazzino dell'anno " + TextField1.Text , 36)=6 then
msgbox " ELIMINO"
end if
end if
else
msgbox " Attenzione, inserire un anno valido"
end if