How to load all the week numbers in Combobox
  • hi Genius

    I dont know how to load All the week numbers of current year  in combo box plz will you help me 
  • 3 Comments sorted by
  • can you please explain what you actually want with example ?
  • i have one combobox. at the form load time i have to show all the week numbers of current year .(the combo box display member is current year's week number)
    if the current year has 53 weeks means the combo box should load like
    1
    2
    3
    .
    .
    .
    53
    or 52 means
    1
    2
    3
    .
    .
    .
    52
  •   int week;
            int weekno;
            public void GetWeekNo()
            {
                CultureInfo myCI = new CultureInfo("en-US");
                Calendar myCal = myCI.Calendar;

                // Gets the DTFI properties required by GetWeekOfYear.
                CalendarWeekRule myCWR = CalendarWeekRule.FirstDay;
                DayOfWeek myFirstDOW = DayOfWeek.Monday;

                // Displays the total number of weeks in the current year.            
                week = myCal.GetWeekOfYear(DateTime.Now, myCWR, myFirstDOW);
            }

           

            private void WeeklyReportForm_Load(object sender, EventArgs e)
            {
                weekno = _Getrepo.GetWeeksInYear(DateTime.Now.Year);
                for (int i = 1; i <= weekno; i++)
                {
                    WeekCmboBox.Items.Add(i);
                }
                GetWeekNo();
    }

Howdy, Stranger!

It looks like you're new here. If you want to get involved, or you want to Ask a new Question, Please Login or Create a new Account by Clicking below

Login with Facebook

Popular Posts of the Week

    Optimum Creative