So instead of this showing up on clicking the dropdown menu.
I want the dropdown to be like this when clicked.
Thanks a lot for any help.
Try the following code:
DateTime newDateValue = new DateTime(dateTimePicker_month.Value.Year, 1, 1);
dateTimePicker_month.Value = newDateValue;
dateTimePicker_month.Format = DateTimePickerFormat.Custom;
dateTimePicker_month.CustomFormat = "MMM-yyyy";
dateTimePicker_month.ShowUpDown = true;
You have to add (1,1) for february month which having 28/29 days to ascertain the all the month values.If you want the query to select month.Following is an example:
string month = dateTimePicker_month.Value.Month.ToString();
string year = dateTimePicker_month.Value.Year.ToString();
use the following query to select month:
select CAST(date AS DATE) from table where DATEPART(month, date) = '" + month + "' and DATEPART(year,date) = '" + year + "'