DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   VB.NET (http://www.daniweb.com/forums/forum58.html)
-   -   Bindingnavigator,Datagridview,textboxes (http://www.daniweb.com/forums/thread114039.html)

miss_cindy Mar 15th, 2008 8:13 am
Bindingnavigator,Datagridview,textboxes
 
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


All times are GMT -4. The time now is 6:03 pm.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC