Esempio n. 1
0
            /// -------------------------------------------------------------------------
            /// <summary>
            ///     休日コンボボックスデータロード </summary>
            /// <param name="tempBox">
            ///     ロード先コンボボックスオブジェクト名</param>
            /// -------------------------------------------------------------------------
            public static void Load(ComboBox tempBox)
            {
                // 休日配列
                string[] sDay = { "01/01元旦",    "     成人の日",  "02/11建国記念の日", "     春分の日",   "04/29昭和の日",
                                  "05/03憲法記念日", "05/04みどりの日", "05/05こどもの日",  "     海の日",    "     敬老の日",
                                  "     秋分の日",  "     体育の日",  "11/03文化の日",   "11/23勤労感謝の日", "12/23天皇誕生日",
                                  "     振替休日",  "     国民の休日", "     土曜日",    "     年末年始休暇", "     夏季休暇" };

                try
                {
                    comboHoliday cmb1;

                    tempBox.Items.Clear();
                    tempBox.DisplayMember = "Name";
                    tempBox.ValueMember   = "Date";

                    foreach (var a in sDay)
                    {
                        cmb1      = new comboHoliday();
                        cmb1.Date = a.Substring(0, 5);
                        int s = a.Length;
                        cmb1.Name = a.Substring(5, s - 5);
                        tempBox.Items.Add(cmb1);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "休日コンボボックスロード");
                }
            }
Esempio n. 2
0
            /// ---------------------------------------------------------------------
            /// <summary>
            ///     休日コンボ表示 </summary>
            /// <param name="tempBox">
            ///     コンボボックスオブジェクト</param>
            /// <param name="dt">
            ///     月日</param>
            /// ---------------------------------------------------------------------
            public static void selectedIndex(ComboBox tempBox, string dt)
            {
                comboHoliday cmbS = new comboHoliday();
                Boolean      Sh   = false;

                for (int iX = 0; iX <= tempBox.Items.Count - 1; iX++)
                {
                    tempBox.SelectedIndex = iX;
                    cmbS = (comboHoliday)tempBox.SelectedItem;

                    if (cmbS.Date == dt)
                    {
                        Sh = true;
                        break;
                    }
                }

                if (Sh == false)
                {
                    tempBox.SelectedIndex = -1;
                }
            }