i want that as many date time pickers must get enabled in the form as the no. selected in the combobox.
Please help

Do you want to create the DateTimePickers at run time? Please explain a bit more on what you want.

i mean that,suppose there are values from 1-10 in the combobox.suppose 1 select 4 then 4 datetime pickers appear bsid it.please help

Perhaps this will help: Create an empty forms application and put a NumericUpDown control on the form and add a numericUpDown1_ValueChanged event handler. For the rest fill in this code:

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        private const int MaxPickers = 10;
        private DateTimePicker[] DatetimeGetters = new DateTimePicker[MaxPickers];

        public Form1()
        {
            InitializeComponent();
        }

        private void numericUpDown1_ValueChanged(object sender, EventArgs e)
        {
            NumericUpDown MyUpDown = sender as NumericUpDown;
            int count = (int)MyUpDown.Value;
            for (int i = 1; i <= count; i++)
            {
                DatetimeGetters[i] = new DateTimePicker();
                DatetimeGetters[i].Location = new System.Drawing.Point(100, 70 + i * 30);
                DatetimeGetters[i].Name = "dateTimePicker" + i.ToString();
                DatetimeGetters[i].Size = new System.Drawing.Size(200, 20);
                this.Controls.Add(DatetimeGetters[i]);
            }
        }
    }
}

No testing for overflow conditions has been done here, just the bare essentials.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.