string strYear = cboYear.Text.Trim();
string strMonth = cboMonth.Text.Trim();
DateTime dt = Convert.ToDateTime(strYear + "-" + strMonth);
DateTime d1 = new DateTime(dt.Year, dt.Month, 1); //d1是选中月的第一天,d2选中月的最后一天,
DateTime d2 = d1.AddMonths(1).AddDays(-1); //最后一天的算法是:得到选中月的第一天然后增加一月,再减去一天,
dtEnd.Value = DateTime.Now.Date.AddSeconds(86399); //当天23:59:59