Error: Can't create child list

G

Guest

I have a master table named keywwordsets and two child tables keywords and
searchphrase. I created relations in the xsd file: ID to KeywordSetID in
both cases. In the underlying Access database these same relationships are
also defined.

The KeywordSet table is bound to 3 textboxes and a checkbox. The child
tables are bound to grids. The datasources are the dataset dsWKS1 and the
datamembers are the relations
KeywordSets.KeywordSetsKeywords
KeywordSets.KeywordSetsSearchPhrase

I tried several times to make a datamember that didn't start with the
KeywordSets table (somehow this seems wrong to me) but the compiler rejected
all my attempts.

When I try to open frmFullWord I get the following error


system.argumentexception
cannot create a child list for field KeywordSetsKeyword
system.windows.forms.bindingcontext.ensurelistmanager
system.windows.forms.bindingcontext.get_item
frmFullWord_Load line 679

The line is cmK = CType(BindingContext(dsWKS1,
"KeywordSets.KeywordSetsKeyword"), CurrencyManager)

in the snippet

Try
cm = CType(BindingContext(dsWKS1, "KeyWordSets"), CurrencyManager)
AddHandler cm.ItemChanged, AddressOf cm_ItemChanged
AddHandler cm.PositionChanged, AddressOf cm_PositionChanged
AddHandler daWKS.RowUpdated, AddressOf OnRowUpDated
cmK = CType(BindingContext(dsWKS1,
"KeywordSets.KeywordSetsKeyword"), CurrencyManager)
cmSP = CType(BindingContext(dsWKS1,
"KeywordSets.KeywordSetsSearchPhrase"), CurrencyManager)

daWKS.Fill(dsWKS1, "KeywordSets")
daWK.Fill(dsWKS1, "Keywords")
daWSP.Fill(dsWKS1, "SearchPhrase")

Can somebody please help me solve this error?

Thanks.

Dennis
 
K

Kevin Yu [MSFT]

Hi Dennis,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you have bind your Textboxes and
DataGrids to the DataSet. However, when you're trying to get the
CurrencyManager from binding context, an ArgumentException is thrown. If
there is any misunderstanding, please feel free to let me know.

Based on the exception message, I think there might be something wrong with
the parameters for getting the BindingContext. What to be the datasource
and what to be the datamember depends on how you add bindings to each
control. Could you show me the code that you bind the Textbox? If you could
email me the package with repro steps, it will be more quickly for me to
resolve it. Thanks!

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
G

Guest

Thanks Kevin,

I will do both. I set the datasource and datamembers in the property box.
I'll list those.
I want to mention that the error doesn't occur on the curency manager cm.
It occurs in cmK, the currency manager for the Keywords Table. I'm sure you
saw that, but I'm just being extra cautious.

Here are the property settings for the dgrdKeyword
DataSource dsWKS1
The choices were
dsWKS1.Keywords
dsWks1.KeywordSets
dsWKS1.SearchPhrase

If I choose dsWKS1.Keywords, the choices for datamember are only 'none'.
Similar to SearchPrhase.

Under dswks1.KeywordSets the choices for datamember are keywordsetskeyword
and keywordsetssearchphrase.

Similarly, under dswks1, the choices are keywordsets -> datamembers choices
keywordsetskeywords and keywordsetssearchphrases.

There are also the choices keywords and searchphrase, but they lead to
datamembers 'none'.

I choices dswks1 as the datasource.

Thanks again.

I am also sending you the app with instructions.

Dennis
 
K

Kevin Yu [MSFT]

Hi Dennis,

Thanks for your code. Based on my debugging, there are 2 points of mistakes.

1. dgrdKeyword has the wrong value and DataSource and DataMember. Please
check and set the DataSource to dsWKS1, and DataMember to
"KeywordSets.KeywordSetsKeywords".

2. There is a mis-spelling in your code when trying to get the
CurrencyManager cmK. You missed an 's' in DataMember. It has to be
"KeywordSets.KeywordSetsKeywords" instead of
"KeywordSets.KeywordSetsKeyword". Please correct the code with the
following line.

cmK = CType(BindingContext(dsWKS1, "KeywordSets.KeywordSetsKeywords"),
CurrencyManager)

HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
M

[MSFT]

Hi Dennis,

Did Kevin's suggestion work in your project? If you still have any concerns
on this issue, please feel free to let me know.

Regards,

Luke
 

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