miss_cindy 0 Newbie Poster

Hy :) ,

I need help please ! :-/
I am developping an application with vb.net and sql server .I have a form containing a datagridview ,textboxes ,bindingsource and bindingnavigator .
I want that the columns of the selectedrow of datagridview appear and change in textboxes when the selectedrow is changed by the bindingnavigator buttons .
This is what i wrote in the my code :

Private Sub gridproduits_RowStateChanged(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewRowStateChangedEventArgs) Handles gridproduits.RowStateChanged
TextBox1.Text = gridproduits.SelectedRows(0).Cells(0).Value
TextBox2.Text = gridproduits.SelectedRows(0).Cells(1).Value
TextBox3.Text = gridproduits.SelectedRows(0).Cells(2).Value

End Sub

But it doesn't work ! :'( .It appears an error message :
Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.