22 November 2012

Date of birth picker user control

  • Introduction
  • DOB picker user control implementation in windows form application
  • DOB related SQL queries for storing, retreival and search
  • Conclusion

Introduction

Often when developing application which have requirememts to deal with customer profile, the ask is usefull way of handling the dates of interests like Customer Date of birth(DOB), Anniversary dates, etc. For example if you are implementing a windows application using .NET, it doesnt have usefuall way of collecting date of interests attributes of customers. When somebody askes for date of birth, no one willing to tell the year of birth :). But the usual DateTimePicker control in .NET is not much usefull because there year has to be entered.
And also if you want to search customers in the month of November, etc we cannot use the date time picker control available by default in .NET winform or be it in web forms.
This made to create a user control in windows form application to work with dates of interest i.e, DOB, etc. The same control can also be created in web forms as well.

DOB picker user control implementation in windows form application

Lets have a look at the below windows user control
Date of birth user control in windows forms

The first dropdown selection is for the month selection, the second is for the day selection and third drop down is for the year selection. This type of design not mandates the selection of year.
Date of birth user control showing only date and month selection
Lets look at the other very important usage of the control. If your application has the need search the customers who born in a specific month, specific day and month or between given date range., this control is very usefull. Lets a have look at how this control can be used in search operations.
Date of birth user control usage in search related operations

The DOB user cntrol project built on .NET 3.5 using the VS 2008 can be downloaded from here