private void SearchResultsTableSelectionChanged(object sender, EventArgs e) { tableViewWf.ClearSelection(); int[] rows = searchResultsTableView.GetSelectedRows(); if (rows.Length > 0) { int row = rows[0]; int ind = (int)searchResultsTableView.GetEntry(row, 0) - 1; string cname = (string)searchResultsTableView.GetEntry(row, 1); tableViewWf.SetSelectedViewIndex(ind); for (int i = 1; i < rows.Length; i++) { int row1 = rows[i]; int ind1 = (int)searchResultsTableView.GetEntry(row1, 0) - 1; tableViewWf.SetSelectedViewIndex(ind1); } tableViewWf.ScrollToRow(ind); int colInd = tableModel.GetColumnIndex(cname); tableViewWf.ScrollToColumn(colInd); tableViewWf.tableView.SwitchOnTextBox(); object entry = tableViewWf.GetEntry(ind, colInd); if (entry != null && !(entry is DBNull)) { tableViewWf.tableView.SetAuxText(entry.ToString()); } } tableView.Invalidate(true); }
public int GetColumnIndex(string columnName) { if (columns == null) { int index = baseModel.GetColumnIndex(columnName); if (index == -1) { throw new Exception(string.Format("Could not find column name {0} in table {1}", columnName, Name)); } return(index); } for (int i = 0; i < ColumnCount; i++) { if (GetColumnName(i).Equals(columnName)) { return(i); } } throw new Exception(string.Format("Could not find column name {0} in table {1}", columnName, Name)); }
public int GetColumnIndex(string columnName) { if (columns == null) { int index = baseModel.GetColumnIndex(columnName); if (index == -1) { throw new ArgumentException($"Could not find column name {columnName} in table {Name}"); } return(index); } for (int i = 0; i < ColumnCount; i++) { if (GetColumnName(i).Equals(columnName)) { return(i); } } throw new ArgumentException($"Could not find column name {columnName} in table {Name}"); }