471,624 Members | 1,767 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,624 software developers and data experts.

Very odd Databinding behaviour

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
0 905

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Jeff | last post: by
3 posts views Thread by Kevin Swanson | last post: by
7 posts views Thread by Justin Hoffman | last post: by
5 posts views Thread by Peter M. | last post: by
1 post views Thread by XIAOLAOHU | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.