|
-
May 22nd, 2013, 05:08 PM
#1
Thread Starter
New Member
What happened to my combobox list?
Hello all,
I've been working for a few months on a project in order to teach myself how to use VB. I downloaded 2010 Express and have been making great progress, but now I am stumped.
I have 2 sets of comboboxes, one of 3 and one of 5. The set of three are each databound to the same table of my database each with a different bindingsource. The set of five is databound to a different table of the same database, each with a different bindingsource. I selected a column for the display member (which happens to be the same name on both tables) which populates the dropdown list for each combobox. This way, you can select three list items from one table (the first set) and five from the other table (the second set). I ran my de-bug and everything worked perfectly.
I moved on to another form, setting up some printing functions that were directly involved with the selected items in the comboboxes. Set that up without a problem. Now, however, when I de-bug the program, the second set of comboboxes has nothing listed in the dropdown. I assumed it was something I recently added, so I removed my most recent additions. Still nothing. I removed the table adapter and binding sources, made a new table adapter and re-bound the comboboxes. Nothing. I can use the binding sources from any other table and they work fine, but this one table on this one form refuses to populate the comboboxes. The SQL query shows that the table adapter and the binding source both have all of the data I need in them, so what gives?
Is there someway I can completely remove this table adapter and start from scratch? Or is there another way to work around this?
-
May 23rd, 2013, 04:47 PM
#2
Re: What happened to my combobox list?
That's pretty novel. I don't deal with table adapters, though I probably should. Still, can you confirm that the datatable that is being bound actually has records? Have you confirmed that your display value column is really what you think it should be (I can't think of any reason why it would change without you knowing about it, but you might as well check it)? Also, how many slots are there in the dropdown? The point to the last question is that I am wondering if the control is sizing to show a bunch of items, but for some reason they aren't displayed, or if the control is acting like there is no data to display.
My usual boring signature: Nothing
 
-
May 23rd, 2013, 10:00 PM
#3
Re: What happened to my combobox list?
I would also test the value returned by the call to Fill on your table adapter. If it is zero then no records are being retrieved, which is a different problem to records being retrieved but not displayed.
Also, are you calling Fill in the Load event handler? If so then maybe an exception is being thrown, but it would be swallowed in that case. You might try adding an exception handler to your Load event handler to see if that's the case, e.g.
Code:
Try
'your code here
Catch ex As Exception
MessageBox.Show(ex.ToString())
End Try
-
May 24th, 2013, 10:42 PM
#4
Thread Starter
New Member
Re: What happened to my combobox list?
jmcilhinney,
I gave your suggestion a try and there is an error thrown: "System.Data.ConstraintException: Failed to Enable Contraints" However, it is not on the table I am having trouble with, it is on the table that works. Could this error cause the problem with my other table? It doesn't seem likely.
-
May 25th, 2013, 07:22 AM
#5
Thread Starter
New Member
Re: What happened to my combobox list?
I looked at a couple of websites about this error and found that I had EnforceConstraints on my DataSet set to True. I set it to false and everything's working again. Thanks for the help guys!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|