By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,837 Members | 1,813 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,837 IT Pros & Developers. It's quick & easy.

Very odd Databinding behaviour

P: n/a
I have a ComboBox and a TextBox bound to a Dataset/datatable returned from a
SQL Database. The databinding is set in Design Mode.

Everything works fine on my initial fill, and I get the correct list of
items in the combobox, and the textbox which is bound to a second column in
the same table, changes to the appropriate value when a new item is selected
in the ComboBox. The ComboBox is displaying a list of products, and the
texbox the number remaining in inventory.

However, as the program is used, I need to refill the Dataset to reflect any
changes in product availability, or # of products remaining in inventory. I
Clear the Dataset, set my select command parameters, and refill the dataset.
(The actual code is identical to the code used to fill it in initially).

Now, the ComboBox shows the first item in the list as the selected text,
clicking the dropdown shows me the correct list of products, however I
cannot select a new item from the list. Regardless of what I do, the
SelectedText is reset to the first item in the list. In addition, the
TextBox supposed to show inventory quantity, is now blank (no value).

I hope someone has some idea what might be happening here, I can't seem to
figure out what the problem is.

Thanks,

Code used to fill Dataset.
Try
Me.DsRenewProductList1.Clear()
Me.daProductList.SelectCommand.Parameters.Item("@D istributorID").Value =
appSettings.DistributorID
Me.daProductList.Fill(Me.DsRenewProductList1, "cw_authproductselect")
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Critical, "SQL Error updating Product
List")
Return False
End Try

The ComboBox databinding:
Tag: DsRenewProductList1 - cw_authproductselect.SKU
Text: DsRenewProductList1 - cw_authproductselect.ProductName
DataSource: DsRenewProductList1
DisplayMember: cw_authproductselect.ProductName
ValueMember: cw_authproductselect.ProductName

TextBox databinding:
Text: DsRenewProductList1 - cw_authproductselect.authCount

Nov 21 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.