Exemple #1
0
        public void ShowCBB(ComboBox cboCategory, ComboBox cboProducer, ComboBox cboOrigin)
        {
            cboCategory.DataSource    = dataCategory.Get();
            cboCategory.ValueMember   = "id";
            cboCategory.DisplayMember = "name";

            cboProducer.DataSource    = dataProducer.Get();
            cboProducer.ValueMember   = "id";
            cboProducer.DisplayMember = "name";

            cboOrigin.DataSource    = dataOrigin.Get();
            cboOrigin.ValueMember   = "id";
            cboOrigin.DisplayMember = "name";
        }
Exemple #2
0
        public void ShowDGV(DataGridView dGV, BindingNavigator bN, TextBox txtId, TextBox txtName)
        {
            DataTable     data = dataCategory.Get();
            BindingSource bS   = new BindingSource();

            bS.DataSource = data;

            if (data != null)
            {
                txtId.DataBindings.Clear();
                txtId.DataBindings.Add("Text", bS, "id", false, DataSourceUpdateMode.Never);

                txtName.DataBindings.Clear();
                txtName.DataBindings.Add("Text", bS, "name", false, DataSourceUpdateMode.Never);
            }

            dGV.AutoGenerateColumns = false;
            dGV.DataSource          = bS;
            bN.BindingSource        = bS;
        }