My greatest critics (the users) have spoken - the DataGridView is CRAP

PhillD

Well-known member
Joined
Mar 5, 2010
Messages
91
Programming Experience
10+
After completing my latest form in .NET, I decided to submit it for testing to the intended end users. This was the first in-house developed .NET app they have seen and the results were not good.

They use .NET every day via our ERP system, so they have a good handle on what to expect and how a program should work. I have attempted to model my new system in the style and functionality of the current ERP system so to minimize the training.

Some of the comments I received were:
"It doesn't work right"
"It seems foreign"
"It's not logical"

Obviously, these are not comments I am happy with considering they are complaining about the native functionality of the DataGridView. Here is a screen shot so you can see what they are testing.
ExpenseTypes.JPG

You are looking at a simple data maintenance form. There are 3 columns.
ExpenseTypeID
Description
GLAccount

ExpenseTypeID is auto generated when they enter a line
Description is manual text entry
GLAccount is a combo box entry

First, the good. They like the fact it's a grid. In comparison to our current ERP system, it's quick and easy for maintaining this kind of data. There are no pages to scroll through, all the values are present on 1 screen and can be edited easily.

The Bad.
1. They complained that when they press enter, the grid creates a new row, instead of tabbing to the next column.

2. When they type into the combo box, they cannot see the actual entry they are making. (I knew they would dislike this one)

3. When you first click into a combo box, the combo shows either the first entry in the combo value list, or the same entry as the value of the data row above it. When you click out of the combo box, the value disappears.

As far as I am aware, this is all by design of the DataGridView and I don't know how to fix this without having to create my own grid control.

So
1. If this is intended design, why do my users complain that it "feels foreign"
2. Why would Microsoft package a control that obviously unfinished.
3. How can I fix this.

I am quite angry about this, I knew it was going to be an issue but developed the grid anyway. I need to use the grid but have to improve it's functionality. I have looked at the grid from DevExpress but it looks like I am going to have to re-write a lot of code if I switch to using it. As a comparison, here is a screen shot of a form from our ERP system. It doesn't have any of the problems I have mentioned above.SyteLine.JPG

Can someone please advise me.
 
1. Your wording says it all:
They complained that when they press enter, the grid creates a new row, instead of tabbing to the next column.
In most Windows apps and every Microsoft app that I can think of, Enter means move to the next row and Tab means move to the next column. If the want to Tab to the next column then they should use Tab. That is absolutely by design and there's no reason for Microsoft to have done it differently. If you want your app to behave differently then you at liberty to handle the appropriate event(s), trap the Enter key and shift focus wherever you want.

2. I don't really understand what you're saying. The DataGridViewComboBoxColumn is designed to host combo boxes that behave like a regular ComboBox with its DropDownStyle property set to DropDownList. In fact, that's exactly what it does do. If you want yours to behave differently then you're free to to inherit the DataGridViewComboBoxCell class, add your own functionality and then host in in your own custom column, as we are all free to make any custom columns we want that do absolutely anything we want them to.

3. This one I can say too much about. It doesn't sound like what I seem to recall from my own experience but I haven't tested specifically so I can't say for sure. I'd guess that that's something specific to your app though, as I have used combo box columns before and don't remember that ever happening.
 
I did some more testing on this yesterday and did find an issue.

I tested using a combo box directly on the form and found that it worked as I would expect. However, the combo box in the grid is different. Maybe it is related to the .DropDownStyle property but it is not available as a properly in the GridView control. I have never done inheritance and from other users comments in other forums, fixing this issue is difficult.

Do you have time to look at this and help me further?

Personally, I do not understand why the GridCombo would be any different from the regular combo. Do you have any insights?
 
First up, a DataGridView is not a GridView. They are two different things. Terminology is important. Incorrect terminology is a good way to cause confusion.

As for why a ComboBox control in a DataGridView is different to a standard ComboBox, the answer is that it isn't. There's more to it than that though. There are three classes that interact in a grid column. In this case, it's the DataGridViewComboBoxColumn, DataGridViewComboBoxCell and DataGridViewComboBoxEditingControl classes. The column class obviously controls how the column works, plus it contains the default configuration for the cells. Each cell picks up its configuration from the column when it's created. When you start editing a cell, an editing control is created and embedded in the cell, picking up its configuration from the cell. In this case, the Value property of the cell is assigned to the SelectedValue property of the control. Once you finish editing, the control is removed and its SelectedValue is assigned back to the Value property of the cell.

Now, the most usual use for a combo box column is when the table bound to the grid contains a foreign key from the table bound to the column. You select the name of a parent record in the control and the corresponding ID is pushed back to the child table. If you allow the user to type directly into the cell, the situation becomes complicated. What value actually gets pushed back to the cell from the control? If the user types a value in then there's no corresponding ID, so the cell would have to get the SelectedValue sometimes and the Text other times. Rather than enforce their interpretation of a rarely used scenario on everyone, Microsoft have left it up to the individual to provide their own implementation. If you want specific behaviour then you have to implement that behaviour. Think of it as a good opportunity to learn about the inner workings of the DataGridView. You might gain a better appreciation for how much work has been put into it and why certain things haven't been done.
 
Back
Top