469,648 Members | 1,410 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,648 developers. It's quick & easy.

BindingSource with Controls + DataGridView problem


I have a DataGridView, that contains a list of Articles, which can be added
(automaticly via the AllowUserToAddRows) and changed by the user. The
current item is also displayed in textboxes under the datagridview, to give
more space for the user to change the item.

But I'm getting some werid results with it:
- When I add the first item to the DataGridView, and I change the values of
the cells in the DataGridView, these values are only shown/updates in the
bound textboxes when leaving the cell. I guess this is kind of normal
behviour, because the valditing will happen when I leave the cell?
- But when I add a second/thord/... row, it doesn't update it's values
anymore to the textboxes. It only does when leaving the second row
(selecting the first one) and entering again the second row. And even then:
when changing a cell and going to another cell in this second row, the
textbox isn't updated...

Does anybody know why this happens? what did I wrong with my DataBinding?
Basicly, what I need is: Whenever I change a value in the DataGridView, the
corresponding textbox should change, and when I change a textbox, the
corresponding cell of the slected item in my DataGridView should change.

Thanks a lot in advance,
Any help, sample or article helping me with this would be really

My code for the binding:
Private Sub DoDataBindingArticles()
Me.dgvArticles.DataSource = Nothing

If MyRequisition.MyArticles IsNot Nothing Then
Me.bisArticles = New BindingSource
Me.bisArticles.DataSource = Me.MyRequisition.MyArticles

Me.dgvArticles.DataSource = Me.bisArticles

Me.txtCodeArticleClient.DataBindings.Add("Text", bisArticles,
"CodeArticle", True, DataSourceUpdateMode.OnPropertyChanged)
Me.txtNomArticleClient.DataBindings.Add("Text", bisArticles,
"NomArticle", True, DataSourceUpdateMode.OnPropertyChanged)
Me.txtArticleSodimex.DataBindings.Add("Text", bisArticles,
"Nom", True, DataSourceUpdateMode.OnPropertyChanged)
Me.txtQuantite.DataBindings.Add("Text", bisArticles, "Quantite",
True, DataSourceUpdateMode.OnPropertyChanged)
Me.txtRefFabricant.DataBindings.Add("Text", bisArticles,
"RefChezFabricant", True, DataSourceUpdateMode.OnPropertyChanged)
Me.txtDescription.DataBindings.Add("Text", bisArticles,
"Description", True, DataSourceUpdateMode.OnPropertyChanged)
End If
End Sub
Apr 11 '06 #1
0 1351

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Przemek M. Zawada | last post: by
5 posts views Thread by jehugaleahsa | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.