473,387 Members | 1,512 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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
Apr 11 '06 #1
0 1806

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: TN | last post by:
I just don't get the BindingSource class when it is bound to a class. Consider this code snip: ..... Private bSource As New BindingSource() Private dgv As New DataGridView() Public Sub New()...
0
by: Pieter Coucke | last post by:
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...
5
by: Rob Dob | last post by:
Hi, I have two c# Winforms. the first form has a datagridview who's datasource is a bindingsource. when you double click on a datagridview row it then opens my second form, which has some...
4
by: michael sorens | last post by:
I have successfully bound an XmlDocument to a DataGridView but all fields seem to be strings. I want to retrofit appropriate datatypes on some of the fields. Let me take this in 2 parts. Part...
1
by: Rob Dob | last post by:
Hi, I have both a Customer and a Orders Table, the key field is CustomerID. I also have a DataGridView that uses a BindingSource created using a join between the Customers table and the Orders...
4
by: shibeta | last post by:
Hello, I have problem with DataGridView and BindingSource. I have created DataSet and added TableData to it with manualy created columns (without DataAdapter - I'm not using MSSQL). On the Form I...
3
by: Przemek M. Zawada | last post by:
Dear Group, I'm developing sample window form, using DataGridView control, which is filled with data through BindingSource, which is based on type of object, as follow: public sampleClass {...
7
by: Mike | last post by:
i have a small difficulties with BindingSource and dataGridView bind db has properly opened and bind doesn't works. Unfortunately I didn't find any good example how to connect MS Access with...
5
by: jehugaleahsa | last post by:
Hello: I am sure this question comes up a lot. I need to disable the controls on my Windows forms so that when the BindingSource is empty some the controls bound to it will be disabled. This...
2
by: Eric B. | last post by:
I could use a little clarification on using a BindingSource with my DataTable. As I understand it, the BindingSource sits between my data source (a DataTable) and DataGridView and any changes made...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.