Пример #1
0
            /// -------------------------------------------------------------------------
            /// <summary>
            ///     工事コンボボックスデータロード </summary>
            /// <param name="tempBox">
            ///     ロード先コンボボックスオブジェクト名</param>
            /// -------------------------------------------------------------------------
            public static void Load(ComboBox tempBox)
            {
                ryowaDataSet dts = new ryowaDataSet();

                ryowaDataSetTableAdapters.M_工事TableAdapter adp = new ryowaDataSetTableAdapters.M_工事TableAdapter();
                adp.Fill(dts.M_工事);

                try
                {
                    comboKouji cmb1;

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

                    foreach (var t in dts.M_工事.OrderBy(a => a.ID))
                    {
                        cmb1      = new comboKouji();
                        cmb1.ID   = t.ID.ToString();
                        cmb1.Name = t.称;
                        tempBox.Items.Add(cmb1);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "工事コンボボックスロード");
                }
            }