PC Review
Forums
Newsgroups
Microsoft DotNet
Microsoft ADO .NET
BindingSource with Controls + DataGridView problem
Forums
Newsgroups
Microsoft DotNet
Microsoft ADO .NET
BindingSource with Controls + DataGridView problem
![]() |
BindingSource with Controls + DataGridView problem |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
Hi,
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 appreciated! Pieter My code for the binding: Private Sub DoDataBindingArticles() 'articles() 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 MyBase.ClearDataBinding(Me.tlpAdd.Controls) 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 |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

