Questions and Answers on any aspect of .NET. Now closed.
I intend to display records read from a database on a form. The database contains 2 tables, a table Job with 2 columns: ID and Occupation, and a table Person with Name and JobID. JobID refers to the row in the table Job with the same ID.
I have a combobox on the form which lists all the occupations (read from the database). These are objects with both a string Name and an int ID, the comboboxs displaymember and valuemember are set to these.
When a record from the table Person is read, the combobox should select the right occupation based on the field JobID.
Is this possible? Anything I found on comboboxes used them as input, while this is closer to output.
One thing about the combobox: the displaymember and valuemember expect a property. For the display member I already had a property, but for the valuemember not, it was declared as a public int. Making it a propery and using the selectedvalue made it work.
This topic is archived. No further replies will be accepted.Other recent topics
Powered by FogBugz