I’ve not been doing much WinForms programming for the last few years, so I’m a bit rusty. Right now I’m having trouble with something pretty simple. I have one table of data that includes two foreign keys to two other tables. What I want to do is simply display a list box that shows a name field from the table and several text boxes below, which display the rest of the data in the row corresponding to what is selected in the listbox.
I tried simply setting the datasource on the listbox and then binding the detail textboxes to columns in the same datasource (using bindingsource), and that seemed to work fine. However, when setting the comboboxes up for the two foreign key columns, they did not reliably change to display the correct value as the user selected different items in the listbox. Additionally, when I made any changes in the detail textboxes, the HasChanges method on the dataset still returned false.
What do I need to do to get this to work correctly? Is there a good example out there somewhere? Google just seems to return a ton of results showing how to populate a simple listbox.
I saw this had been up for a few days so I’ll provide what help I can…
I’m a bit rusty in that area as well. However, the place I always go back to for a refresher is the Forms over Data Video Series by Beth Massi. They are short, sweet and to the point. My guess is that you’ll find what you need within the first few videos.
Disclaimer: The videos were done using VS2005. The fundamentals are solid though. While one or two minor things may have changed, WinForms databinding is pretty much the same as it has been for a while.
HTH and good luck!