|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Select manually a row of dataGridView.Hello.
How can I manually select a row of a dataGridView. The dataGridView is connected to a bindingSource, and the row is added by : Dim dr As DataRow dr = MyDataTable.NewRow() Rows(Rows.Count - 1).Selected = True ' is that correct ? I mean that the new row, should be the current row. How can I do that? Thanks :) On 1 Mayo, 17:51, "Mr. X." <nospam@nospam_please.com> wrote: bindingcontext(dgv.datasource).position = dgv.rows.count - 1 ' for> Hello. > How can I manually select a row of a dataGridView. > The dataGridView is connected to a bindingSource, > and the row is added by : > Dim dr As DataRow > dr = MyDataTable.NewRow() > Rows(Rows.Count - 1).Selected = True ' is that correct ? > > I mean that the new row, should be the current row. > How can I do that? > > Thanks :) datatable bindingcontext(dgv.datasource,"datatablename").position = dgv.rows.count - 1 ' for dataset That's doesn't work.
What I did instead is : setting the current cell to the current row : dim dc as DataGridViewCell dc = Rows(Rows.Count - 1).Cells(0) CurrentCell = dc CurrentRow.Selected = True .... That's works. Update the field works, but inserting doesn't ! I think this because the beginEdit method (or something else) should be called. Thanks :) Show quoteHide quote "Appr3nt1c3" <guerrero.***@hotmail.com> wrote in message news:cb93b2b9-d7db-4a20-94c3-edd6bdabd040@t14g2000prm.googlegroups.com... > On 1 Mayo, 17:51, "Mr. X." <nospam@nospam_please.com> wrote: >> Hello. >> How can I manually select a row of a dataGridView. >> The dataGridView is connected to a bindingSource, >> and the row is added by : >> Dim dr As DataRow >> dr = MyDataTable.NewRow() >> Rows(Rows.Count - 1).Selected = True ' is that correct ? >> >> I mean that the new row, should be the current row. >> How can I do that? >> >> Thanks :) > > bindingcontext(dgv.datasource).position = dgv.rows.count - 1 ' for > datatable > bindingcontext(dgv.datasource,"datatablename").position = > dgv.rows.count - 1 ' for dataset
VB.net
installing SQL 2008 express and database with my vb app Re-using a filestream in a loop Lots of ActiveX COM Controls are missing in "Choose Items" ? ProcessStart(textfile) focus issue Need help printing multiple pages in VB.Net 2008 Adding time to date OLEDB v's Access's FE BE Connection VB.NET Books and Training Material when is web browser control really complete |
|||||||||||||||||||||||