PC Review Forums Newsgroups Microsoft DotNet Microsoft ADO .NET BindingSource with Controls + DataGridView problem

Reply

BindingSource with Controls + DataGridView problem

 
Thread Tools Rate Thread
Old 11-04-2006, 01:37 PM   #1
Pieter Coucke
Guest
 
Posts: n/a
Default BindingSource with Controls + DataGridView problem


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


  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off