DataMember property 'ContractID' cannot be found on the DataSource

G

Guest

Hi,

I get above error when I use the find function on a bindingsource control.
The datasource member of the bindingsource is another bindingsource
control, where the datamember is a relational member of the datasource

The field I'm searching on is absolut in the table behind, I can browse to
it when I debug the bindingsource via the current member.

When I use the table directly on me bindingsource component, it is working
fine. So, only when I bind it to a relational component of another
bindngsource, it doesn't work.

What could be wrong?
Thanks
Bart
 
K

Kevin Yu [MSFT]

Hi Bart,

From your description, I understand that you're setting a BindingSource
object as the DataSource of another BindingSource object, like

BindingSource1.DataSource = BindingSource2;

If there is any misunderstanding, please point me out.

The DataMember property is a member of the DataSource object itself. It has
to be a list(or row) in the DataSource. Now the DataSource is the
BindingSource2 object. The object itself does NOT have a property named
"'ContractID". In this case, we cannot do it like this. Instead, you can
try the following:

BindingSource1.DataSource = BindingSource2.DataSource;
BindingSource1.DataMember = "ContractID";

HTH.

Kevin Yu
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
G

Guest

HI Kevin,

This is my bindingsource snipped:
'bsContract
'
Me.bsContract.AllowNew = True
Me.bsContract.DataMember = "FK_Contracts_Customers"
Me.bsContract.DataSource = Me.bsCustomer

where 'FK_Contracts_Customers' is the relation between Customers and
Contracts and also exist in the bsCustomers databidingsource..
The bsContract bidingsource is behaving normal, I can browse the records
etc, except the find is not working on my fields in the table 'Contracts'
 
K

Kevin Yu [MSFT]

Hi Bart,

To make the Find method work in this case, you have to change the code to
the following:

'bsContract
'
Me.bsContract.AllowNew = True
Me.bsContract.DataSource = Me.fkContactsCustomersBindingSource

fkContactsCustomersBindingSource is an auto generated binding source in
your form that you can use and Contact ID is a part of its properties.

Please try it and let me know the result.

Kevin Yu
Microsoft Online Community Support
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
K

Kevin Yu [MSFT]

Hi Bart,

Although you can see the DataRows, they are not a part of the
BindingSource's properties. You have to get the relationed BindingSource
first and then get its properties.

Kevin Yu
Microsoft Online Community Support
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
K

Kevin Yu [MSFT]

Hi Bart,

I'd like to know if this issue has been resolved yet. Is there anything
that I can help. I'm still monitoring on it. If you have any questions,
please feel free to post them in the community.

Kevin Yu
Microsoft Online Community Support
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top