Level: Beginner
Description:
While creating the User Interface (UI) we need to create a control which can take Year input. For this purpose we can use NumericUpDown control or can use just simple TextBox. But all these controls may require more coding to validate a Year.
DateTimePicker control reduces our work in this type of scenario. We can customize the look and feel of this control to fulfill our UI need. To setup change the following properties in Design View,
Format = Custom
CustomFormat = yyyy
ShowUpDown = True
Now we can check which Year is selected in our code as,
Dim intSelectedYear As Integer
intSelectedYear = Me.DateTimePicker1.Value.Year
No comments:
Post a Comment