calendar
when i click january month in calendar 31 days to be shown in textbox.
similarly,when i click april month in calendar 30 days to be shown in textbox.
similarly when i click particlar month that month days to be days to be displayed in textbox.
how to do.in vb,net using csharp please send the code.
Posted Jul 9, 2012, 3:33 AM
Jignesh TrivediPosted Jul 9, 2012, 3:29 AM
There is inbuilt function DaysInMonth, from which you can get days.
so try...
int year = 2012;
int month = 2;
var d = DateTime.DaysInMonth(year, month);
hope this will help you.
Posted Jul 9, 2012, 2:57 AM
{
int numDays = 0;
switch (month) {
case 1: case 3: case 5:
case 7: case 8: case 10:
case 12:
numDays = 31;
break;
case 4: case 6:
case 9: case 11:
numDays = 30;
break;
case 2:
if (((year % 4 == 0) &&
!(year % 100 == 0))
|| (year % 400 == 0))
numDays = 29;
else
numDays = 28;
break;
default:
Console.WriteLine("Invalid month.");
break;
}
return numDays;
}
Hope this helps you.