Serialcoder en Français Serialcoder in English
TEL : +33 (0)9 72 13 15 17

Windows Forms FAQ

5. Windows Forms Datagrid

5.1 How can I programatically set the rowheight of a row in my DataGrid?
5.2 How can I autosize the rowheights in my datagrid?
5.3 How do I prevent sorting a single column in my DataGrid?
5.4 How do I programmatically select a row in DataGrid?
5.5 How can I translate a point to a cell in the datagrid?
5.6 I lost the settings in my DataGrid set during design-time?
5.7 How do I prevent a click into the grid highlighting a cell?
5.8 How do I prevent the datagrid from displaying its append row (the row at the end with an asterisk)?
5.9 How can I put a combobox in a column of a datagrid?
5.10 How can I catch a double-click into a column header cell?
5.11 How can I select the entire row when the user clicks on a cell in the row?
5.12 How can I get text from a column header in a MouseUp event?
5.13 How do I hide a column?
5.14 How do I color a individual cell depending upon its value or some external method?
5.15 How can I put a checkbox in a column of my DataGrid?
5.16 How can I restrict the keystrokes that will be accepted in a column of my datagrid?
5.17 How do I make a field auto increment as new rows are added to my datagrid?
5.18 How can I prevent a particular cell from being editable?
5.19 How do I move columns in a datagrid?
5.20 How can I do cell by cell validation in a datagrid?
5.21 How do I programmatically determine the selected rows in a datagrid?
5.22 How can I move rows by dragging the row header cell?
5.23 I want to do custom handling of special keys such as the Tab key or F2 in the TextBox of a column in the DataGrid. How do I subclass this TextBox to get at it virtual members?
5.24 How can I have a column of icons in my datagrid?
5.25 How can I tell if the current row has changed and whether I am on the AddNew row or not?
5.26 How do I hide the gridlines or set them to a particular color?
5.27 How can I get the selected text in an active gridcell?
5.28 How do I determine whether a checkbox in my datagrid is checked or not?
5.29 How can I bind the datagrid to a datasource without using any wizards?
5.30 How can I bind two datagrids in a Master-Detail relationship?
5.31 How do I get the row or column that has been clicked on?
5.32 How do I add an unbound column to my bound datagrid?
5.33 How do I get the row and column of the current cell in my datagrid?
5.34 How can I prevent the Enter key from moving to the next cell when the user is actively editing the cell and presses Enter?
5.35 How do I set the width of a column in my DataGrid?
5.36 How can I implement OLE Drag & Drop between a DataGrid and another OLE DnD object that supports the Text format?
5.37 How can I make my DataGrid support a single select mode, and not the default multiselect mode?
5.38 How can I get celltips or tooltips to vary from cell to cell in my DataGrid?
5.39 How can I get notification of the changing of a value in a column of comboboxes within my datagrid?
5.40 How can I make the datagrid have no currentcell?
5.41 How can I make my grid never have an active edit cell and always select whole rows (as in a browser-type grid)?
5.42 I have hidden (column width = 0) columns on the right side of my datagrid, but tabbing does not work properly. How can I get tabbing to work?
5.43 How can I get the number of rows in my DataGrid?
5.44 How do I format a date column in a datagrid?
5.45 How can I change the width of the row headers or hide them?
5.46 How do I catch a doubleclick in my datagrid?
5.47 How can I make my last column wide enough to exactly occupy all the client area of the datagrid?
5.48 How can I prevent my user from sizing columns in my datagrid?
5.49 How can I catch the bool values changing in a DataGridBoolColumn?
5.50 When I click on a row header, the row is selected and no cell is active. How can I do this programmatically?
5.51 How can I force the vertical scrollbar in my DataGrid to always be visible?
5.52 How can I autosize a column in my datagrid?
5.53 How can I get rid of the error icon that appears when there is an editing error?
5.54 How do I find the top-left visible cell in a datagrid?
5.55 I want to display negative values with a CR suffix, instead of a minus sign. How can I perform custom formatting on the cells in my datagrid?
5.56 I want to do sort of a database join of two tables. How can I use data from two DataTables in a single DataGrid?
5.57 How do I display a column of buttons such as pushbuttons or combobox buttons?
5.58 How can I put up a confirmation question when the user tries to delete a row in the datagrid by clicking on the row header and pressing the Delete key?
5.59 How can I enable column selections in my datagrid?
5.60 How do I programmatically scroll the datagrid to a particular row?
5.61 How can I place text in the rowheader column of my datagrid?
5.62 How do I set default values for new rows in my datagrid?
5.63 How do I iterate through all the rows and columns in my datagrid?
5.64 How can I specially color only the currentcell of my readonly datagrid?
5.65 How can I make the Enter Key behave like the Tab Key and move to the next cell?
5.66 How do I use the DataColumn.Expression property to add a computed/combined column to my datagrid?
5.67 How can I change the font used in a grid cell on a cell by cell or row by row basis?
5.68 How can I use a mouse to select cell ranges in my datagrid?
5.69 How can I control the cursor over my DataGrid?
5.70 How can I programatically add and remove columns in my DataGrid without modifying the DataTable datasource?
5.71 How can I have a column of bitmaps in a DataGrid?
5.72 How can I add my custom columnstyles to the designer so I can use them in my DataGrid at design time?
5.73 After scrolling with the mouse wheel on a selected row in a DataGrid I cannot get it back into view. Is there a work around?
5.74 How can I make the DataGrid column be blank and not display (null) as the default value?
5.75 How can I add a DateTimePicker column style to the DataGrid?
5.76 How do I determine the DataGridTableStyle MappingName that should used for a DataGrid to make sure the grid uses my tablestyle?
5.77 I have a derived DataGridColumnStyle. From within my Paint override, how can I get at other values in the DataGrid?
5.78 How do I retrieve the current row from a DataTable bound to a DataGrid after the grid has been sorted?
5.79 How can I catch when the user clicks off the grid, say to close the form?
5.80 How can I get a CheckBox column in a DataGrid to react to the first click?
5.81 How can I use events to restrict key input to grid cells?
5.82 How can I format columns in my DataGrid without explicilty adding DataGridColumnStyles?
5.83 How can I auto-adjust keyboard input? For example, make typing 12312002 be taken as a valid date, 12/31/2002.
5.84 Can I display the rows in my datagrid in a free-form layout using textboxes on a panel?
5.85 How can I tell whether a scrollbar is visible in my DataGrid is visible?
5.86 How do I autosize the columns in my DataGrid so they always fill the the grid's client area?
5.87 How can I prevent all the cells in my DataGrid from being edited without deriving GridColumnStyle?
5.88 How can I prevent the plus-minus icon that appears next to the row header when I have a datagrid displayed bound to a datasource that has a relation defined?
5.89 How can I display master-details-details in three separate grids?
5.90 In my datagrid, if I press tab to enter a column using a derived columnstyle, the column does not receive focus. Why?
5.91 How can I detect when a cell starts being edited, not when it becomes current?

 

Windows forms FAQ