Esempio n. 1
0
        private void LoadList(SortableBindingList <Data> item)
        {
            if (lstContractList.Count > 0)
            {
                lstContractList = item;
            }
            else
            {
                lstContractList.AddNew();
            }

            var list = new BindingList <Data>(item);

            dgvContractList.DataSource = list;
            //SortableBindingList<Data> items = (SortableBindingList<Data>)dgvContractList.DataSource;
            //items.ToList().AddRange(item);
            //ContractsBindingSource.DataSource = items;
            //dgvContractList.DataSource = ContractsBindingSource;
            var clist = new List <Data>()
            {
                new Data {
                    Contract = "Joe",
                },
                new Data {
                    Contract = "Misha",
                },
            };
            var bindingList = new BindingList <Data>(clist);
            var source      = new BindingSource(bindingList, null);

            dgvContractList.DataSource = source;
        }
Esempio n. 2
0
    public void SubmitButton_Handler(object sender, EventArgs e)
    {
        Person p = _personList.AddNew();

        if ((p.FirstName == string.Empty) || (p.LastName == string.Empty))
        {
            MessageBox.Show("First Name and Last Name cannot be blank!");
            _personList.CancelNew(_personList.IndexOf(p));
        }
        else
        {
            ClearEntryControls();
        }
    }