private delegate
void del_LoadMonth();
private delegate
void del_LoadYear();
private void LoadMonth()
{
if (cboMonth.InvokeRequired)
cboMonth.Invoke(new del_ LoadMonth(LoadMonth),null);
else
{
for
(int i = 0; i < 12; i++)
{
cboMonth.Items.Insert(i, CultureInfo.CurrentUICulture.DateTimeFormat.MonthNames[i]);
}
cboMonth.SelectedIndex = DateTime.Now.Month - 1;
}
}
private void LoadYear()
{
try
{
if
(cboYear.InvokeRequired)
cboYear.Invoke(new del_ LoadYear(LoadYear),
null);
else
{
int
iCurrentYear = DateTime.Now.Year;
for
(int i = 2014; i <= iCurrentYear; i++)
{
cboYear.Items.Add(i.ToString());
}
cboYear.SelectedIndex = (cboYear.Items.Count
- 1);
}
}
catch (Exception ex)
{
}
}
No comments:
Post a Comment