From: Mr. X. on
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 :)

From: Appr3nt1c3 on
On 1 Mayo, 17:51, "Mr. X." <nospam(a)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
From: Mr. X. on
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 :)

"Appr3nt1c3" <guerrero.rey(a)hotmail.com> wrote in message
news:cb93b2b9-d7db-4a20-94c3-edd6bdabd040(a)t14g2000prm.googlegroups.com...
> On 1 Mayo, 17:51, "Mr. X." <nospam(a)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

From: Mr. X. on
Problem solved.
Was a mistake of mine on code ...

Thank, anyway :)
 | 
Pages: 1
Prev: VB.net
Next: SMTP Mail Problem