473,404 Members | 2,213 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,404 software developers and data experts.

BindingSource, Custom DataSource and DataGridView driving me mad!

Hi-

OK, I've got a DataGridView, I've created a BindingSource from one of my
Business Entity object (based on generated classes from EntitySpaces) I've
left the default column setup so that all the columns are displayed.

My DataSource objects are composed like this:

class Customer : esCustomer // where esCustomer is the EntitySpaces class
that was generated
{
public string PropTest
{
get{ return "PropTest!"; }
}
}
esCustomer has some properties as well that were generated from my DB
schema, but from what I can see from teh code.. that shouldn't matter.

The problem is, all the properties that are in esCustomer are bound to the
DataGridView correctly, however none of the properties I add to Customer are
displayed.
I have checked and double checked that I'm indeed using the correct class
for the BindingSource object.

I've searched for events that I can subscribe to so I can try and debug the
binding process, but I'm not seeing anything that appears to expose the code
that is trying to fetch the properties.

I'm stuck and frustrated. Anyone want to suggest anything I should try?

Thanks for reading,
Steve Klett
Jun 20 '06 #1
2 9628
Steve,

Did you actually write a code to bind the binding source to an instance of
your Customer class. This is not done by the designer. The designer uses the
class to initialize the datagirdview, but doesn generate code to bind the
binding source to actuall instance of that class. It can do that because it
doesn't know where to get this instance from.

If you look at the InitializeComponent method you'll see that the binding
source is actually set up with the Type object of your class. This doesn do
much at run time.

What you need to do is in your form constructor or in some other place in
your code after the InitialzeComponent is called you need to add

this.customerBindingSource.DataSource = this.costumer;

where this.contumer is created and instialized instance of the Costumer
class.

BTW if you want the datagridview to reflect the changes made to the
properties of the business at run-time (after the grid is bound) your
business object needs to implement INotifyPropertyChanged interface and fire
the event anytime a property changes

--
HTH
Stoitcho Goutsev (100)

"Steve" <sk**@skle.com> wrote in message
news:OC**************@TK2MSFTNGP04.phx.gbl...
Hi-

OK, I've got a DataGridView, I've created a BindingSource from one of my
Business Entity object (based on generated classes from EntitySpaces) I've
left the default column setup so that all the columns are displayed.

My DataSource objects are composed like this:

class Customer : esCustomer // where esCustomer is the EntitySpaces
class that was generated
{
public string PropTest
{
get{ return "PropTest!"; }
}
}
esCustomer has some properties as well that were generated from my DB
schema, but from what I can see from teh code.. that shouldn't matter.

The problem is, all the properties that are in esCustomer are bound to the
DataGridView correctly, however none of the properties I add to Customer
are displayed.
I have checked and double checked that I'm indeed using the correct class
for the BindingSource object.

I've searched for events that I can subscribe to so I can try and debug
the binding process, but I'm not seeing anything that appears to expose
the code that is trying to fetch the properties.

I'm stuck and frustrated. Anyone want to suggest anything I should try?

Thanks for reading,
Steve Klett

Jun 20 '06 #2
Very good information, thank you for taking the time to explain this! I'm
up and running now.
Have a good day,
Steve

"Stoitcho Goutsev (100)" <10*@100.com> wrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
Steve,

Did you actually write a code to bind the binding source to an instance of
your Customer class. This is not done by the designer. The designer uses
the class to initialize the datagirdview, but doesn generate code to bind
the binding source to actuall instance of that class. It can do that
because it doesn't know where to get this instance from.

If you look at the InitializeComponent method you'll see that the binding
source is actually set up with the Type object of your class. This doesn
do much at run time.

What you need to do is in your form constructor or in some other place in
your code after the InitialzeComponent is called you need to add

this.customerBindingSource.DataSource = this.costumer;

where this.contumer is created and instialized instance of the Costumer
class.

BTW if you want the datagridview to reflect the changes made to the
properties of the business at run-time (after the grid is bound) your
business object needs to implement INotifyPropertyChanged interface and
fire the event anytime a property changes

--
HTH
Stoitcho Goutsev (100)

"Steve" <sk**@skle.com> wrote in message
news:OC**************@TK2MSFTNGP04.phx.gbl...
Hi-

OK, I've got a DataGridView, I've created a BindingSource from one of my
Business Entity object (based on generated classes from EntitySpaces)
I've left the default column setup so that all the columns are displayed.

My DataSource objects are composed like this:

class Customer : esCustomer // where esCustomer is the EntitySpaces
class that was generated
{
public string PropTest
{
get{ return "PropTest!"; }
}
}
esCustomer has some properties as well that were generated from my DB
schema, but from what I can see from teh code.. that shouldn't matter.

The problem is, all the properties that are in esCustomer are bound to
the DataGridView correctly, however none of the properties I add to
Customer are displayed.
I have checked and double checked that I'm indeed using the correct class
for the BindingSource object.

I've searched for events that I can subscribe to so I can try and debug
the binding process, but I'm not seeing anything that appears to expose
the code that is trying to fetch the properties.

I'm stuck and frustrated. Anyone want to suggest anything I should try?

Thanks for reading,
Steve Klett


Jun 21 '06 #3

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

Similar topics

2
by: Jarod | last post by:
Hey I tried to use bindingSource created by wizard from dataGridView. I set it to bind data from my class I have public property "Source" that returns list of objects with property of ...
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()...
1
by: Pieter | last post by:
Hi, I have a custom List that inherits from BindingList. It has some methods overloaded, like the Add/Insert/etc to add and remove some eventhandlers when adding or removing an item T of the...
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...
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...
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...
3
nev
by: nev | last post by:
I havah bindingnavigator onah form andah datagridview. I wanna binda grid to the bindingnavigator so that i can navigate thru the items using the bindingnavigator. dtt is programmatically filled...
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: TamusJRoyce | last post by:
I am working on a group project where I do not have access to a BindingSource that is being passed through a function. The BindingSource's DataSource is set to a custom IBindingListView Collection....
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.