Пример #1
0
        private void LoadCategories()
        {
            DataSet ds = new DataSet();
            cCategory cat = new cCategory();

            ds = cat.CategoryGet();

            cmbCtgy.DataSource = ds.Tables[0];
            cmbCtgy.ValueMember = "CategoryID";
            cmbCtgy.DisplayMember = "Category";

            cmbCtgy.SelectedIndex = -1;
        }
Пример #2
0
        private void LoadCategories()
        {
            DataSet ds = new DataSet();
            try
            {
                cCategory cat = new cCategory();
                cat.CategoryID = 0;
                ds = cat.CategoryGet();

                dgvCat.DataSource = ds.Tables[0];

                dgvCat.Columns[0].HeaderText = "Category ID";
                dgvCat.Columns[1].HeaderText = "Category";
                dgvCat.Columns[2].HeaderText = "Date Added";

                dgvCat.Columns[0].Visible = false;
                dgvCat.Columns[1].Width = 200;
                dgvCat.Columns[2].Width = 200;

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                ds.Dispose();
            }
            txtCat.Enabled = false;
            txtCat.Focus();
        }