Link to home
Start Free TrialLog in
Avatar of mathieu_cupryk
mathieu_cuprykFlag for Canada

asked on

date of birth control for visual 2005

i need a date of birth control for visual 2005.
Avatar of Ravi Singh
Ravi Singh
Flag of United Kingdom of Great Britain and Northern Ireland image

Hi,

You could use the DateTimePicker control thats available in the toolbox... to get the selected date use the Value property which returns a DateTime object:

            DateTime dob = this.dateTimePicker1.Value;

Then use the DateTime properties and methods, e.g.:

            string year = dob.Year;
            string month = dob.Month;
            string day = dob.Day
            string dobInShort = dob.ToShortDateString();
Avatar of Mikal613
You can make your own and customize it.

http://www.codeproject.com/cs/miscctrl/MonthCalendar.asp
some corrections to my example:

            DateTime dob = this.dateTimePicker1.Value;
            string year = dob.Year.ToString();
            string month = dob.Month.ToString();
            string day = dob.Day.ToString();

            string dobInShort = dob.ToShortDateString();
Avatar of mathieu_cupryk

ASKER

I cannot use the calendar control it is too big,
where is the datetimepicker?
it is a web form.
ASKER CERTIFIED SOLUTION
Avatar of Ravi Singh
Ravi Singh
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial