Announcement

Collapse
No announcement yet.

aktuelle Woche im MonthCalendar selektieren

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • aktuelle Woche im MonthCalendar selektieren

    Hallo zusammen!
    Ich finde keine einfache Möglichkeit, wie man in einem MonthCalendar initial Montag bis Freitag der aktuellen Woche selektieren kann. Jemand eine Ahnung?

  • #2
    Jemand eine Ahnung?
    Ja. Somit ist deine Frage beantwortet.


    mfG Gü
    "Any fool can write code that a computer can understand. Good programmers write code that humans can understand". - Martin Fowler

    Comment


    • #3
      Wie kann beim MonthCalender initial Mo bis Fr der aktuellen Woche markiert werden?
      [highlight=c#]
      private void Form1_Load(object sender, EventArgs e)
      {
      Calendar kalender = CultureInfo.CurrentCulture.Calendar;
      DayOfWeek heute = kalender.GetDayOfWeek(DateTime.Now);
      int diff = heute - DayOfWeek.Monday;
      DateTime montag = DateTime.Now.AddDays(-diff);
      DateTime freitag = montag.AddDays(5);

      monthCalendar1.SelectionRange = new SelectionRange(montag, freitag);
      }
      [/highlight]

      mfG Gü
      "Any fool can write code that a computer can understand. Good programmers write code that humans can understand". - Martin Fowler

      Comment


      • #4
        Originally posted by gfoidl View Post
        Ja. Somit ist deine Frage beantwortet.

        mfG Gü
        Danke, mehr wollte ich gar nicht wissen.

        Comment


        • #5
          Originally posted by gfoidl View Post
          [highlight=c#]
          private void Form1_Load(object sender, EventArgs e)
          {
          Calendar kalender = CultureInfo.CurrentCulture.Calendar;
          DayOfWeek heute = kalender.GetDayOfWeek(DateTime.Now);
          int diff = heute - DayOfWeek.Monday;
          DateTime montag = DateTime.Now.AddDays(-diff);
          DateTime freitag = montag.AddDays(5);

          monthCalendar1.SelectionRange = new SelectionRange(montag, freitag);
          }
          [/highlight]

          mfG Gü
          Funktioniert, Vielen Dank!

          Comment

          Working...
          X