Home All Groups Group Topic Archive Search About

how to select the newly added row in datagridview

Author
12 Jul 2006 4:22 PM
mike
I have a datagridview control and a button on the windows form. I am
adding a new row in button click event. When the number of rows grow,
the newly added row will not be
visible but a scroll bar will be shown.

I want the program to highlight the newly added row and make it visible

in the datagridview by scrolling to that position when a new row was
added by button click event. How can you do that?  Thanks in advance.

Author
12 Jul 2006 7:48 PM
vbnetdev
Me.DataGridView1.DataSource = dt
Me.DataGridView1.MultiSelect = False
Me.DataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect
Me.DataGridView1.CurrentCell = Me.DataGridView1.Item(0, 2)
(obviosuly find the cell of the newly added row by checking the row count
of your dataset or collection that is bound)

--
Get a powerful web, database, application, and email hosting with KJM
Solutions
http://www.kjmsolutions.com



Show quoteHide quote
"mike" <mikekimh***@gmail.com> wrote in message
news:1152721379.160327.133080@35g2000cwc.googlegroups.com...
>I have a datagridview control and a button on the windows form. I am
> adding a new row in button click event. When the number of rows grow,
> the newly added row will not be
> visible but a scroll bar will be shown.
>
> I want the program to highlight the newly added row and make it visible
>
> in the datagridview by scrolling to that position when a new row was
> added by button click event. How can you do that?  Thanks in advance.
>