currencymanager.position doesn't change

  • Thread starter Thread starter Jeremy
  • Start date Start date
J

Jeremy

I have a dataset containing 2 tables. A is the master table, B is a lookup
table. There is a combobox bound to B, which updates a value in a FK field
in A.

my currencymanager is created thus:
cmB= CType(frm.BindingContext(DsClient1.Tables("B")), CurrencyManager)

The cbx has these settings:
cbx.valuemember=b.primarykey
cbx.displaymember=b.name
cbx.datasource=dsclient1
cbx.(databindings).selecteditem=b.primarykey
cbx.(databindings).selectedvalue=a.foreignkey
cbx.(databindings).text=b.name

When I change the value in the combobox, cmClientMaster.position does not
change.

Any suggestions?

Jeremy
 
You show us you assinging cmB being assinged a Binding Context.. yet you
talk about cmClientMaster.

Same thing? or perhaps a typo? or just something you missed. =)

-CJ
 
Alright... lets try a couple things.

First.. get rid of this crap
cbx.(databindings).selecteditem=b.primarykey
cbx.(databindings).selectedvalue=a.foreignkey
cbx.(databindings).text=b.name

second..

just use

cbx.selectedvalue = a.foreignkey

third...

if all that doesnt work.. define your currency manager as

cmB = Ctype(BindingContext(dsClient1, "B"), CurrencyManager)

that should respond when the value changes in the lookup box (combo box).
your master has to respond differently.. try this and we'll get to more
later.

by the way, what is the frm.Bindingcontext? Self reference? or are you
doing this outside of the scope of your form (the manager resides in a
different class than the form itself.)

-CJ
 
CJ, changing the currencymanager to

cmB = Ctype(BindingContext(dsClient1, "B"), CurrencyManager)

made the main difference.

I took out the (databindings) as you suggested, except for selectedvalue
(can't seem to find the cbx.selectedvalue property in the property
inspector).

frm is because the form is started with a shared method
(myform.Execute(sdasd,asdfasdf,asdfsf) that does a new on the form. It's an
mdi app.

Thanks, I greatly appreciate your help. Hopefully I'll figure out how to
find stuff like this in the dox someday.

Jeremy
 
Back
Top