hog Posted November 12, 2003 Posted November 12, 2003 I have four combo boxes that are populated from a dataset. When a customer is selected the forms controls are populated with the customers data and the combo boxes are set like this: Me.cboRegion.Text = m_Customer.Region All works OK until I make a change and save the customer detail then this happens; Reselect customer all combo box texts are blank Select another customer some combo box text are blank Select another customer all combo box text are ok Reselct my first customer all combo box text are ok I have checked the m_Customer properties and they have the correct data in them, it just does not seem to display to the combo box text? Well sometimes it does sometimes it doesn't?? Quote My website
Moderators Robby Posted November 12, 2003 Moderators Posted November 12, 2003 Are they bound? Quote Visit...Bassic Software
hog Posted November 12, 2003 Author Posted November 12, 2003 Yep they are bound to datasets. Quote My website
Moderators Robby Posted November 12, 2003 Moderators Posted November 12, 2003 I thought we covered combo boxes a couple of months ago, you cannot assign values to the Text property and get expected resuts while a control is bound. Quote Visit...Bassic Software
hog Posted November 12, 2003 Author Posted November 12, 2003 ? can't remember that...but all was working fine before I place another combo box on the form. I was able to set the text of the combo box to the customer data, make modifications, save view customer again and all was well?? Quote My website
hog Posted November 13, 2003 Author Posted November 13, 2003 Robby, I've done a search for the post you mention above but had no luck :( Can you point me to it cos the more I think about it the more I vaguely remember something about it....I think:) Quote My website
Moderators Robby Posted November 13, 2003 Moderators Posted November 13, 2003 In this thread http://www.xtremedotnettalk.com/showthread.php?threadid=78226&highlight=combobox I thought we discussed not using the Text property on a bound control, but I guess not. Quote Visit...Bassic Software
hog Posted November 13, 2003 Author Posted November 13, 2003 Aha so I'm not goin nuts :):) However hope I'm not labouring on a point but this is just weird ; The comboboxes are bound to datasets. On loading the customer data I set the combobox text to match. I can move between different customers and the comboboxes always show the correct customer data. If I modify any control on the form and save the customer then select another customer all controls are displayed correctly except the comboboxes? If I continue to move through the customers the comboboxes eventually start to show the correct data. So are you saying that the Text property is unstable when the combobox is bound to a dataset? Quote My website
Moderators Robby Posted November 13, 2003 Moderators Posted November 13, 2003 It's not unstable, you just are using it incorrectly, there may be some combobox events triggering these unexpected results. Instead, use the SelectedIndex and other methods that utilize the bound values or even the Add method to add new items. Quote Visit...Bassic Software
hog Posted November 14, 2003 Author Posted November 14, 2003 Yeah I've tried doing it another way but always get errors:( Say my combobox has the bound values; LONDON PARIS NEW YORK MADRID And I select a customer whose data includes say NEW YORK. How do I get the combobox to point to the bound data of NEW YORK and display it also? Quote My website
hog Posted November 18, 2003 Author Posted November 18, 2003 (edited) I'm getting nowhere with this problem:( Say I want the combobox to display NEW YORK? I presume I can find this value in the combobox thus; Me.cboLocation.FindStringExact("NEW YORK") but I cannot get it to display the text NEW YORK???? Edited November 18, 2003 by hog Quote My website
pendragon Posted November 18, 2003 Posted November 18, 2003 Me.ComboBox1.SelectedIndex = Me.ComboBox1.FindStringExact("NEW YORK") Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.