|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Adding new row to table in DataGridViewAfter adding a new row (programmatically) to a table/view that is being
displayed in the DataGridView control, the new row appears in the DataGridView grid. Now, how do I select that new row? If the DataGridView is sorted by one of the columns/fields, the new row could show up anywhere (based on the sort criteria). Thanks. Hi Bob,
maybe this helps: void Grid_RowsAdded(object sender, DataGridViewRowsAddedEventArgs e) { _grid.FirstDisplayedCell = _grid.Rows[e.RowIndex].Cells[0]; } Show quoteHide quote "b**@datasync.com" wrote: > After adding a new row (programmatically) to a table/view that is being > displayed in the DataGridView control, the new row appears in the > DataGridView grid. Now, how do I select that new row? > > If the DataGridView is sorted by one of the columns/fields, the new row > could show up anywhere (based on the sort criteria). > > Thanks. > > Thanks for the idea. (What do you know -- there's a "RowsAdded" event
in the thing!). But no, it doesn't help, because "e.rowindex" returns 0 -- I guess the new row gets put first on the grid. But then, if the grid is sorted (which it always is, in my app), the new row immediately gets put somewhere else, so the "0" points to the new first row, which is NOT the one just added. Good idea, though. It makes me want to try harder to look through all the possible events when I have this kind of problem. That's something I still need to do with this problem! wansch wrote: Show quoteHide quote > Hi Bob, > > maybe this helps: > void Grid_RowsAdded(object sender, DataGridViewRowsAddedEventArgs e) > { > _grid.FirstDisplayedCell = > _grid.Rows[e.RowIndex].Cells[0]; > } > > "b**@datasync.com" wrote: > > > After adding a new row (programmatically) to a table/view that is being > > displayed in the DataGridView control, the new row appears in the > > DataGridView grid. Now, how do I select that new row? > > > > If the DataGridView is sorted by one of the columns/fields, the new row > > could show up anywhere (based on the sort criteria). > > > > Thanks. > > > >
Distributed Programming
Dates at Midnight Rewriting the Textbox Obscure error Registering hot-keys for your Winform DatagridView comboboxcolumn - assign cell value [Regular Expression] match a word with interpunctuation Newbie Needs Help ! Find out the MAC-Adress of a server How to have .net code call pager or phone |
|||||||||||||||||||||||