Click here to Skip to main content
15,880,796 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi!

I have this script thats make a month dropdown list from 1 to 12 with the english month names, how can i hardcode it so its using danish names?

VB
Dim dtfi As New DateTimeFormatInfo()
For month As Integer = 1 To 12
    Dim li As New ListItem()
    li.Text = dtfi.GetMonthName(month) & " (" & month.ToString() & ")"
    li.Value = month.ToString()
    dobm.Items.Add(li)
Next


Thank you all in advance.
Posted

1 solution

The Danish month names can be obtained as an array of strings as follows:
C#
string[] monthNames = System.Globalization.CultureInfo.GetCultureInfo("da-DK").DateTimeFormat.MonthNames;

//monthNames content

//januar
//februar
//marts
//april
//maj
//juni
//juli
//august
//september
//oktober
//november
//december
 
Share this answer
 
Comments
[no name] 4-Jun-12 10:46am    
Thanks for the quick reply.

Let me check this.
Manas Bhardwaj 4-Jun-12 11:19am    
nice +5
VJ Reddy 4-Jun-12 11:50am    
Thank you, Manas :)
taha bahraminezhad Jooneghani 4-Jun-12 12:56pm    
nice answer 5!
VJ Reddy 4-Jun-12 13:18pm    
Thank you, taha :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900