private void szukajTextBox_TextChanged(object sender, EventArgs e) { if (!string.IsNullOrEmpty(szukajTextBox.Text)) { fireDataGridSelectionChanged = false; var idx = DataGridBindingSource.Find((System.ComponentModel.PropertyDescriptor)null, szukajTextBox.Text); if (idx > -1) { DataGrid.CurrentCell = DataGrid.Rows[idx].Cells[0]; } else { szukajTextBox.Text = szukajTextBox.Text.Substring(0, szukajTextBox.Text.Length - 1); szukajTextBox.SelectionStart = szukajTextBox.Text.Length; } fireDataGridSelectionChanged = true; } }
private void findTextBox_TextChanged(object sender, EventArgs e) { if (!string.IsNullOrEmpty(findTextBox.Text) && fireFindTextBoxChanged) { fireDataGridSelectionChanged = false; var idx = DataGridBindingSource.Find("Kod", findTextBox.Text); if (idx > -1) { DataGrid.CurrentCell = DataGrid.Rows[idx].Cells[0]; } else { findTextBox.Text = findTextBox.Text.Substring(0, findTextBox.Text.Length - 1); findTextBox.SelectionStart = findTextBox.Text.Length; } fireDataGridSelectionChanged = true; } }
private void findTextBox_TextChanged(object sender, EventArgs e) { if (!string.IsNullOrWhiteSpace(findTextBox.Text)) { try { disableOnSelectionChanged = true; int idx = DataGridBindingSource.Find("Kod", findTextBox.Text); if (idx != -1) { this.DataGrid.CurrentCell = this.DataGrid.Rows[idx].Cells[0]; } else { findTextBox.Text = findTextBox.Text.Substring(0, findTextBox.Text.Length - 1); findTextBox.SelectionStart = findTextBox.Text.Length; } } finally { disableOnSelectionChanged = false; } } }
private void visibleChanged(int rowIndex) { DataGridBindingSource.RemoveAt(rowIndex); }