G
Guest
Hi everyone,
I’m am new to C# and trying to convert to C# from VB.Net an article I found
at 4GuysFromRolla.com:
http://aspnet.4guysfromrolla.com/articles/090104-1.aspx titled Extending the
Calendar Control’s Date Navigation by Mehmet Genc.
What I am trying to accomplish is enhance the web calendar control that
comes with Visual Studio.Net so that it has two drop-down lists, containing
the months and years. This way, a user can quickly jump to a specific month
or year with one click. The code was written in VB.Net and I am trying to
convert it to C#.
There two parts to this code I am having problem translating:
1. After populating the drop-down list with the months there is a part of
the code that updates the control with the chosen month:
VB.Net version:
'Make the current month selected item in the list
drpCalMonth.Items.FindByValue(MonthName(DateTime.Now.Month)).Selected =
True
2. I am having difficulty translating the part that populates the year
drop-down list:
VB.Net version:
For intYear = DateTime.Now.Year - 20 To DateTime.Now.Year + 20
drpCalYear.Items.Add(intYear)
Next
I’m am new to C# and trying to convert to C# from VB.Net an article I found
at 4GuysFromRolla.com:
http://aspnet.4guysfromrolla.com/articles/090104-1.aspx titled Extending the
Calendar Control’s Date Navigation by Mehmet Genc.
What I am trying to accomplish is enhance the web calendar control that
comes with Visual Studio.Net so that it has two drop-down lists, containing
the months and years. This way, a user can quickly jump to a specific month
or year with one click. The code was written in VB.Net and I am trying to
convert it to C#.
There two parts to this code I am having problem translating:
1. After populating the drop-down list with the months there is a part of
the code that updates the control with the chosen month:
VB.Net version:
'Make the current month selected item in the list
drpCalMonth.Items.FindByValue(MonthName(DateTime.Now.Month)).Selected =
True
2. I am having difficulty translating the part that populates the year
drop-down list:
VB.Net version:
For intYear = DateTime.Now.Year - 20 To DateTime.Now.Year + 20
drpCalYear.Items.Add(intYear)
Next