views:

410

answers:

3

I'm developing a windows form application ported over from a very basic lotus notes database app. As an example of There is a "Jobs" table a "Parts" table and a many to many relationship table "Job_Parts" with JobID and PartID.

When adding a new job record I need a input method for the user to select from the parts list and I envision this being a checkbox list and allowing the user to quickly check off the parts in the job. I have done something similar in asp.net and binding the checkbox list to the "Parts" table and then capturing selections and adding them to a new many to many record should work. I need some help on when pulling up the job record to edit, how to then bind the parts records selected in the many to relationship records into the checkbox list.

The second request may not be something that can be matched in windows forms in comparison to the lotus notes checkbox list control. In the lotus notes control a user could easily use a key strokes within the checkbox list by typing the first couple letters of a part select a value and then a pressing comma allows them to begin typing the next part.. and so on.

Has anyone seen anything like this, or any other way to quickly (with a keyboard) select many to many data.

As I'm about to submit this... I begin adding tags to the question and realize this is the perfect and quick method of doing what I need. Has anyone done the same in winforms, if so can you send me some pointers?

A: 

The standard way of implementing this is called a Master-Detail form; if you search for this you will find many implementations.

In your case there would be a master grid of Jobs and a second detail grid of Parts, clicking a job will show all the parts. You can use the standard WinForms grid controls for adding, editing, and deleting rows.

If you want to allow keyboard navigation, you could allow switching between the grids with Tab, and between the rows and columns of a grid with the arrow keys.

If you want to use a checkbox-like interface you could list all possible parts for each job and check off the desired parts using the space bar.

Dour High Arch
Thank you for answering... I tried using winforms grid for the parts list and it does work. But it leaves a lot to be desired from a usability stand point. I'm actually looking to implement something more like the tag input in Stack Overflow that allows the user to partially type a part and it comes up. I will be using something similar to this. http://stackoverflow.com/questions/133049/control-for-tags-with-auto-completion-in-winforms
+1  A: 

Not sure I can describe this verbally, but here goes:

At the top of the form is a list of jobs, possibly a combobox or listbox, depending on how often you think the user will be navigating between jobs.

Below that, on the left side, is a listbox of all available parts. On the right, is a listbox of parts currently associated with the job. Between these two listboxes, an "ADD >>" button, and a "<< REMOVE" button. If only one of each part is allowed, per job, you can move the parts between the two list boxes: when the user adds a part, it is removed from the list of available parts and appears in the list of job parts, and the reverse if the user removes a part.

This approach allows the user to hold the Control key and select multiple parts to add or remove at once.

Hope that helps

HiredMind
A: 

I work for a seed testing company and we have the same format of data. This is how we do it.

Adding a new job:

I would use a data-bound list box (using a BindingSource object) for your parts list and have a filter box at the top thusly

---------------------
| Filter (Text Box) |
---------------------
| List Box          |
|                   |
|                   |
---------------------

You can then use the Filter property on the BindingSource object to filter the list displayed in the list box. I would then have an "Add" button near it to allow the user to select the part and add it to another list box containing the selected parts. It will probably be easier for you to use the DisplayMember and ValueMember properties of the ListBox to add the parts as the index isn't going to help you much and comparing strings isn't usually worth it.

I think this solution should answer both your requests.

Boerema