473,396 Members | 1,775 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,396 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 1551

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...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.