I would like to display a WinForms data grid control to the user to pick a specific row and then act upon the ID value for that row. My problem is that the basic format of the grid control is designed for editing, and not so much selecting. Say I have the following fields in my data source - FieldID, Name, Description - I want the data grid to do the following:
- Track the FieldID for each row, but do not display it
- As the mouse moves over each row, the background color for the entire row changes so the user can easily identify what row they are over
- When the user clicks anywhere on the row, not just on the row header, I want a MsgBox displayed indicating the appropriate FieldID of the row
- When the user clicks, the grid does NOT turn the cell editable (selecting the text and placing the cursor)
- Not display the Row header (it looks ugly)
I would also like to find out how to accomplish the following if possible:
- Make the grid fill up the entire width of the control if there are fewer fields than would normally fill up the control
- Make the grid horizontally scroll if there are more fields than would normally fill up the control
- Somehow "autofit" the column widths
I could easily do all of this in WebForms, but I don't know how to do it in WinForms. Any help is appreciated!
Start Free Trial