Thursday, 28 April 2011

Culture Specific Month Name in Combobox using C#.



Culture Specific Month Name in Combobox using C#.





using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Globalization;
namespace WindowsFormsApplication8
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            DD_Monthbind();
        }
        private void DD_Monthbind()
        {
            DateTimeFormatInfo info = DateTimeFormatInfo.GetInstance(null);
            for (int i = 1; i < 13; i++)
            {    
            comboBox1.Items.Add(i.ToString()+ ")"+ "  " + info.GetMonthName(i) + "--" + i.ToString());
            }
        }
    }
}

No comments:

Post a Comment