Пример #1
0
        private void getAllAccounts()
        {
            try
            {
                dtAccount = accountData.GetAccountsByDataSet().Tables[0];

                txtUsername.DataBindings.Clear();
                txtPassword.DataBindings.Clear();
                txtName.DataBindings.Clear();

                txtUsername.DataBindings.Add("Text", dtAccount, "Username", true, DataSourceUpdateMode.Never);
                txtPassword.DataBindings.Add("Text", dtAccount, "Password", true, DataSourceUpdateMode.Never);
                txtName.DataBindings.Add("Text", dtAccount, "FullName", true, DataSourceUpdateMode.Never);

                dgvAccounts.DataSource = dtAccount;
                btnDelete.Enabled      = true;
                btnRestore.Enabled     = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }