Advertisement

01.02.2004 at 12:28PM PST, ID: 20839283
[x]
Attachment Details

Formatting the DataGrid - VB.NET WinForms

Asked by bmccleary in .NET

Tags: datagrid, row

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
[+][-]01.02.2004 at 01:47PM PST, ID: 10031018

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]01.03.2004 at 07:58AM PST, ID: 10033828

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: .NET
Tags: datagrid, row
Sign Up Now!
Solution Provided By: emoreau
Participating Experts: 3
Solution Grade: A
 
 
[+][-]01.06.2004 at 10:01AM PST, ID: 10054260

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32