Exemple #1
0
        private void SelectedRow_Click(object sender, EventArgs e)
        {
            Int32 rowToDelete = DGVClients.Rows.GetFirstRow(DataGridViewElementStates.Selected);

            DGVClients.Rows.RemoveAt(rowToDelete);
            DGVClients.ClearSelection();
        }
Exemple #2
0
 private void EditRow_Click(object sender, EventArgs e)
 {
     if (DGVClients.SelectedRows.Count == 1)
     {
         var          clientForEdit = (Client)DGVClients.SelectedRows[0].DataBoundItem;
         frmNewClient editClient    = new frmNewClient(clientForEdit);
         editClient.ShowDialog();
         DGVClients.DataSource = new BindingList <Client>(_clientLogic.GetClientByName(tbSearchName.Text));
         DGVClients.ClearSelection();
     }
 }
Exemple #3
0
 private void MyDataGridView_MouseDown(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Right)
     {
         var hti = DGVClients.HitTest(e.X, e.Y);
         if (hti.RowIndex >= 0)
         {
             DGVClients.ClearSelection();
             DGVClients.Rows[hti.RowIndex].Selected = true;
         }
     }
 }
Exemple #4
0
        private void BtnFilter_Click(object sender, EventArgs e)
        {
            System.Windows.Forms.DataGridViewColumn Col = default;
            switch (LBoxFilter.SelectedIndex)
            {
            case 0:
                Col = fio;
                break;

            case 1:
                Col = phone;
                break;
            }
            if (RBAsc.Checked)
            {
                DGVClients.Sort(Col, System.ComponentModel.ListSortDirection.Ascending);
            }
            else
            {
                DGVClients.Sort(Col, System.ComponentModel.ListSortDirection.Descending);
            }
        }
Exemple #5
0
 private void RefreshDGVSource()
 {
     DGVClients.DataSource = _clientLogic.GetAllClients();
     DGVClients.RefreshEdit();
 }