コード例 #1
0
        void SetDatainListView()
        {
            CategorylistView.Items.Clear();
            int sr = 1;
            SetupCategoryManager setupCategoryManager = new SetupCategoryManager();
            List <Category>      categoryList         = setupCategoryManager.GetAllData();

            foreach (Category category in categoryList)
            {
                ListViewItem item = new ListViewItem();
                item.Text = sr++.ToString();
                item.SubItems.Add(category.Name);
                CategorylistView.Items.Add(item);
            }
        }
コード例 #2
0
        public ViewItemUI()
        {
            InitializeComponent();
            SetupCompanyManager setupCompanyManager = new SetupCompanyManager();

            companycomboBox.DisplayMember = "CompanyName";
            companycomboBox.ValueMember   = "CompanyID";
            List <Company> companies = setupCompanyManager.GetAllData();

            companycomboBox.DataSource = companies;
            SetupCategoryManager setupCategoryManager = new SetupCategoryManager();

            categorycomboBox.DisplayMember = "Name";
            categorycomboBox.ValueMember   = "Id";
            List <Category> categories = setupCategoryManager.GetAllData();

            categorycomboBox.DataSource = categories;
        }