2Bbear's knowledge workshop

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
 private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            DateTime dt = DateTime.Now;
 
            string text= (e.AddedItems[0as ComboBoxItem).Content as string
            if(text==null || BottomTextBoxDate==null)
            {
                return;
            }
            if (text.Equals("이번주"))
            {
                dt = DateTime.Today.AddDays(Convert.ToInt32(DayOfWeek.Monday) - Convert.ToInt32(DateTime.Today.DayOfWeek));
                BottomTextBoxDate.Text = dt.ToString();
            }
            else if (text.Equals("이번달"))
            {
                dt = DateTime.Today.AddDays(1 - DateTime.Today.Day);
 
                BottomTextBoxDate.Text = dt.ToString();
            }
            else if (text.Equals("올해"))
            {
                dt = DateTime.Today.AddDays(1 - DateTime.Today.Day);
                dt = dt.AddMonths(1 - DateTime.Today.Month);
                BottomTextBoxDate.Text = dt.ToString();
            }
            else
            {
 
            }
        }
cs



e 매개변수를 사용합시다.