Combo box bindings

G

Guest

Hi,

Is it OK to bind a combo box to more than one datasource?
One is by:
Me.cboState.DataBindings.Add(New Binding("SelectedValue", Me.AddressRow,
"State"))

Another is by a DataView:
aView = New DataView(dsLookup.States)
With Me.cboState
.DataSource = aView
.DisplayMember = "Description"
.ValueMember = "StateAbbr"
End With

Look like it works. But sometimes the field gets empty when I click the
fields around. I steped in and couldn't find any codes doing that. So I
suspect it is a binding issue.

Please help.
Thanks in advance.

Li
 
K

Kevin Yu [MSFT]

Hi Li,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need to know if we can add multiple
databindings to a ComboBox. If there is any misunderstanding, please feel
free to let me know.

Yes, we can add different bindings to different properties for a control.
But we can add only one binding for one property. Based on the code you
have provided, it is correct. However, I'm not quite sure what you mean by
"the field gets empty when I click the fields around". Could you explain it
a little bit more? Thanks!

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

Guest

Hi, Kevin:

After debugging, I found out that after I input something in a text box or
make a selection from a combo box, I click other field. Now the form's
IsDisposed = True and causes all controls' IsDisposed = True. That causes the
fields empty, cursor stuck, etc. But after I click several times, the cursor
moves and everything is ok.

I know it looks weird. But do you have any suggestions about how this may
happen? The form is created as a dialog form.

Thanks.

Li
 
K

Kevin Yu [MSFT]

Hi Li,

This is weird. To make debugging simpler, could you send me a simple
project that can reproduce the problem? I can debug it on my machine and
work it out more quickly. Thank you.

Remove 'online' from the nospam alias is my email.

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

Guest

Hi, Kevin:

I couldn't create a sample from our project to reproduce the problem. I
dis-bind the fields to workaround the problem.
Now I have another problem but I will post as another thread to have the
Subject related to the issue.

Thanks.

Li
 
K

Kevin Yu [MSFT]

Nice to hear that you have found a workaround.

Thanks for sharing your experience with all the people here. If you have
any questions, please feel free to post them in the community.

Kevin Yu
=======
"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